Exploding land mines cause damage to military vehicles, Programming Languages

In combat simulation software, exploding land mines cause damage to military vehicles. In addition to the damage done to the vehicles themselves, we are interested in the number of injuries suffered by the individuals inside of the attacked vehicle.

Your program should read a file named "vehicles.txt" and another file called "selection.txt".Your program shall compute the expected number of human casualties due to an explosion near a vehicle. See next page for sample input and output.

You may assume that all data in the file are valid, so you don't have to edit them.

 

Input

Create text files in the format shown below for your development and testing. The grader will use two files created by him/her in order to test your program's functionality.

Output

See sample output below. All float data should be output with 3 decimal point precision.You may need the iomanip and cmath packages depending on your system settings.

Use the function below for calculating the expected casualties

doubleexpectedCasualties (doublecasualtyProbability,

intcapacity)

{

    return sqrt(casualtyProbability) * capacity;

}

vehicles.txt contains a list of vehicle types. For each vehicle type, the probability that people inside the vehicle would be injured due to an attack against the vehicle as well as the number of people in the vehicle are listed.

sampleinput file 1:vehicles.txt

Tank         0.2          5

Truck        0.85         14

Motorcycle   1.0          1

// Vehicle   prob.inj.    #personnel

selection.txt contains one vehicle name. This is the type of vehicle that is being attacked.

sampleinput file 2: selection.txt

Truck

sample output to screen:

Tank,0.200,5,2.236

**Truck,0.850,14,12.907**

Each of the values from vehicles.txt should be listed in a comma delimited format with the calculated expected casualty value appended to the end until the selected vehicle is displayed. The remaining records in the input file are ignored (notice that Motorcycle does not appear above).

If the vehicle matches the one in the selection.txt file, then surround that row with ** as shown for Truck above. If there is no matching vehicle, then your program should print out all rows from the vehicles file in a comma delimited format as discussed, but no rows will be enclosed by **.

Posted Date: 3/30/2013 1:59:12 AM | Location : United States







Related Discussions:- Exploding land mines cause damage to military vehicles, Assignment Help, Ask Question on Exploding land mines cause damage to military vehicles, Get Answer, Expert's Help, Exploding land mines cause damage to military vehicles Discussions

Write discussion on Exploding land mines cause damage to military vehicles
Your posts are moderated
Related Questions
Using OOP,write a sample program to get the factorial of a number entered by a user

Calculate the total price to purchase all the components required to build a state-of-the-art gaming computer from components available on the internet. Before attempting this exer

Create a linux shell (in other words, write a C/C++ program) that will recursively prompt for input from the user. The shell should prompt as yourRollNumber-currentDirector

Write a Prolog predicate remove_nth(N,L1,L2) that is true if list L2 is just list L1 with its Nth element removed. If L1 does not have an Nth element then the predicate should fail

WS-Addressing, WS-Reliable Texting and WS-Security WCF tools many innovative Web solutions (WS) expectations such as WS-Addressing, WS-Reliable Texting and WS-Security. With the di

What is an algorithm? What are the characteristics of a good algorithm? An algorithm is defined as “a step-by-step procedure of accomplishing some task'''' An algorithm may be sh

Create a Money data structure that is made up of amount and currency.  (a) Write a constructor for this data structure   (b)  Create accessors for this data structure (c)

1. Write a program that reads a minimum of three command line arguments and displays the program's results. a. Command Line arguments:  i. The first argument will be the program

How and where to start to develop a preprocessor for java

You are to write a program which will answer a pair of questions for squares, triangles, circles and ellipses. A square is defined by its lower left corner (SLLx,SLLy), and the len