Exploding land mines cause damage to military vehicles, Programming Languages

Assignment Help:

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 **.


Related Discussions:- Exploding land mines cause damage to military vehicles

Write a program that draws the initials j, Write a program that draws the i...

Write a program that draws the initials J G P on the form similar to that shown in Fig J 1 (using straight lines and curve semicircles). The figure can not have corners. All ends a

Variation of parameter, VARIATION OF PARAMETERS - HIGHER ORDER DIFFEREN...

VARIATION OF PARAMETERS - HIGHER ORDER DIFFERENTIAL EQUATIONS We now require taking a look at the second method of finding a particular solution to a differential equation

Transform to xhtml, While working in the eHealth Applied Research lab at Mo...

While working in the eHealth Applied Research lab at Mohawk College, you are asked to transform an xml file into an XHTML representationusing XSLT for display in a browser.The xml

General Programming , #questCustomers of a particular restaurant are descri...

#questCustomers of a particular restaurant are described with some categories. If the categories indicate the customer is a senior citizen, or the customer works for the restaurant

Inheritance, The Lost Bay Software Coop purchased EnviroMeasurements, a sma...

The Lost Bay Software Coop purchased EnviroMeasurements, a small startup with a product, GreenStation, that measures pollen count and air quality. The company has ventured

Software problem program, On December 27, 2011, Seymour Gravel, at the urgi...

On December 27, 2011, Seymour Gravel, at the urging of his wife, Mary Walford, has brought you his preliminary figures for his business. Seymour carries on a business writing and e

how to store multidimensional array in a single column in m, how to store ...

how to store multidimensional array in a single column in mysql database using MATLAB?

Program for hold details of all the cabins for travellers, Scenario A ca...

Scenario A campsite provides cabins for travellers to stay in overnight. A 'cabin' is a small wooden hut, containing bunk beds, table and chairs, a heater, and a small cookin

econometrics using r, EF308 Assignment 2 Due: 3pm, 26 April 2012 Introduct...

EF308 Assignment 2 Due: 3pm, 26 April 2012 Introduction This assignment is loosely based on Cheung et al. (2005) and Molodtsova and Papell (2009) and examines the out-of- sample pr

Cobol 85, Open error message coming out when compiling

Open error message coming out when compiling

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd