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
What will be the output for the following instruction if CX=9087H and AX=9090H? 1) BTR AH,2? 10010000=10010000 2) BTC CX,9?1001000010000111=1001000110000111 3) NEG AX?

Define Reasons for using Functions? 1. Evade rewriting the same code over and over. 2. It is simpler to write programs and keep track of what they are doing. Codes are able t

A traveler wants to purchase a number of traveler''s checks, each having a set amount for four different currencies: Mexican pesos, Euro dollars, Swiss francs, and US dollars. A t

Difference between java and j2ee programming In the basic form, the phrase java is placed as a selection terminology. On the other hand, the phrase J2EE is placed as a renderin

We will be assuming here that our roots are of the form, in this case, r 1,2 = l + mi If we take the first root we'll find the following solution. x l + m i It i


What are the main pros and cons of assembly programming language?

A psychologist is interested in learning about the voting behavior of college students.  (4 points for each part.)Design a study which would yield data on this topic. a. state y

about how to create the program in c

Flatten the tree Consider the following XML input, which groups people into two categories-salaried and hourly: Warren Rosenbaum 37 5.75