Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help writing this program in c++ The transcontinental company you are working for has developed its services, and it is going to ship crates

need help writing this program in c++ image text in transcribed
image text in transcribed
image text in transcribed
The transcontinental company you are working for has developed its services, and it is going to ship crates across oceans to all five other continents. The price of cargo ship space to each destination continent is different. Table 1 illustrates the different prices per cubic foot. Therefore, the company needs a menu to choose a specific destination continent. You should use the iomanip library to make the menu alignment. 1- The first line of the menu prompts the user to select an individual continent, and it has six options, as follows: Please select the destination continent: Africa (Af/af) Asia (As/as) Australia (Au/au) Europe (Eu/eu) The Americas (Am/am) Quit (Q/9) 2. Once the menu shows up, the user selects an option, and the program assigns the chosen option to a string variable and checks whether it is valid or not. If the user enters a valid value, output the destination continent's name plus a welcome message. For example, suppose the destination continent is Asia. In that case, the user should enter "As" or "as" (both capital and small form of the first letter is acceptable), and the program should output "Welcome to Asia cargo shipping program. " Please check out example 2 at the end of the assignment. 3. If the user enters Qor q, output a thank you message and quit your program. Please check out example 3 4. If the user enters wrong values that are not available on the menu, output an error message and quit your program. Please check out example I. 5. You will add some functionality to the program to help quote prices to customers. As it is mentioned, a transportation to each continent has a different cost. You can find the minCost, medCost, and the maxCost for each destination continent in the following table. There are three values in the table named minCost (crates with volume less than 40 ft), medCost (crates with volume more than 40 f' and less than 80 ft), and maxCost (crates with volume more than 80 ft). The costs are per cubic foot. Table 1: crates prices per cubic foot to different continents Continent minCost medCost Africa, Asia $4.0 $5.5 Australia, Europe $7.8 $5.7 The Americas $2.5 $3.5 maxCost $8 $10 $6 6- Declare three double variables called maxCost, medCost and minCost in your program, and use the above table and the user selected option from the menu to assign correct values to them. Part 2: 1. Once the destination continent is selected, your program prompts and asks the user how many crates should be sent? Then this number will be assigned to an integer variable called iteration Num. If the entered value for the number of crates is not an integer, use a loop here to keep asking the user to enter a correct value. 2- The company has 10 cargo ships overall, and because of this limitation there is a goal to maximize the number of crates being sent by each cargo ship. So, the company designed some standard crates sizes. There are three types of crates (a, b, and c) with the following properties. The only data needed from the Table 2 is the volume column. You need three global constants to use the Volume size of the different crates' type in your program. a volume = 24.0 // the volume size of the crates type a b_volume = 125.0 // the volume size of the crates type b c volume = 30.0 // the volume size of the crates type c Table 2: Different crates' type. Type Length Width Height Volume a b 2.0 5.0 3.0 3.0 5.0 5.0 4.0 5.0 2.0 24.0 (ft) 125.0 (ft) 30.0 (ft) Surface Diagonal Area 52.0 (It') 5.4 150.0 (ft) 8.7 62.0 (ft) 6.2 C 3. The program starts to prompt the user iteration Num times. (use loops) In each iteration, a message shows up and asks the user, "What type of crate do you want to send? (a/b/c)". The entered value will be assigned to a character variable called ertType. If the user enters something that isn't a character, output an error message, and ask again. (you need a loop here to check). Use a switch statement for checking the crt'Type variable. Cases for characters a, b, and c will be checked, and if there would be other cases that are not acceptable, an error shows up and the counter of the loop should not change. You need three different integer variables called num_a, num_b, and num_c to keep track of different crates numbers. In each iteration, based on the entered crate's type, one of these three variables is incremented. 4. Once all the crates' types are clarified. The program should calculate the total volume of the crates. All you need to do in this step is to multiply the number of that crate's type by its volume. For example, if the iteration Num would be 5 and there would be one type a. two type b, and two type c of crates. Then the total volume will be (2*125)+(2*30) + (24) = 334 (ft'). 5. Every cargo ship has 300 (ft) amount of space. Based on the calculated total volume in (4) find out how many ships are required to send these crates to the destination. Number of cargo ships = [total volume 300 6- Based on the total volume from (4) and the minCost, medCost, and maxCost (from part 1) calculate the total cost. Remember that each cargo ship has a $200 fixed cost. Based on the volume of the crates one of the minCost, medCost, and maxCost will be selected as the variable cost. For example, if the volume will be more than 80 ft", and the destination would be Asia then the variable costs will be the maxCost which is $8. Total cost = Total volume * (variable costs) + Number of cargo ships * $200 7. If more than 10 cargo ships are needed for the crates, output an error, and terminate the program. Otherwise, output, in a nice format, the following values: The number of crates type "a." The number of crates type "b." The number of crates type "c

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Demystifying Databases A Hands On Guide For Database Management

Authors: Shiva Sukula

1st Edition

8170005345, 978-8170005346

More Books

Students also viewed these Databases questions

Question

1 . Television News channels importantance of our Life pattern ?

Answered: 1 week ago

Question

1. How is the newspaper help to our daily life?

Answered: 1 week ago

Question

5. Discuss the key components of behavior modeling training.

Answered: 1 week ago