Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Unit 3 Programming Assignment lease read thoroughly After reading chapters 6, and 7, please solve the followingproblems: Problem 1: Convert to MetersCentimeters (40 points) Write

Unit 3 Programming Assignment

lease read thoroughly

After reading chapters 6, and 7, please solve the followingproblems:

Problem 1: Convert to MetersCentimeters (40 points)

Write aprogram proj3_1.cpp that readsfrom user the length in feet and inches into two separatevariables. Then, your program should convert the feet and inchesinto two other variables holding meters and centimeters. Theconversion factor between feet and meters is 0.3048 meter/feet. Youshould use 3 functions: one for input, one for conversion, and onefor displaying the results with the following prototypes:

void getFeetInches(int &feet, int &inches);

void covertToMeterCentimeter(int feet, int inches, int&meters, int ¢imeters);

void displayResults(int feet, int inches, int meters, intcentimeters);

Input function should not accept negative input. The user shouldbe able to choose to repeat the program for another set of valuesto be converted like example on page 266.
REQUIRED: the input and conversion functions should usecall-by-reference. Must use 4 separate variables for feet, inches,meters, and centimeters.
IMPORTANT: without functions your program will not receive morethan 20 points even if it runs correctly. It's all aboutfunctions.
Sample run:

Enter feet: 4
Enter inches: 5
Result of conversion: 1 meter(s) and 35 centimeters.

Do you want to convert another set of values (Y/N)?Y
Enter feet: 6
Enter inches: 7
Result of conversion: 2 meter(s) and 1 centimeters.

Do you want to convert another set of values (Y/N)? N
Good Bye!

Problem 2: Textbook #7, Inventory Class, page501 (40 points)

HINT: to test Inventory class follow the instruction fromthe attached file, InventoryTester_Output.txt
IMPORTANT: totalCost should NOT BE A DATA MEMBER of the classInventory.

nventory tester output with input validation:
Enter item number: -2341
ERROR. Please enter a positive value for item number.
Enter item number: 2341
Enter item cost (per unit): $14.75
Enter the quantity: -5
ERROR. Please enter a positive value for quantity.
Enter the quantity: 5
Inventory Summary
Item: 2341
Price per unit: $14.75
Quantity: 5
Total cost: $73.75

Hint for Inventory class: Follow the example in the textbookfor Account class declaration, implementation, and usage. Yourmain() should be much simpler (pages 470 - 474)

Submit the ".cpp" and ".h" files with the followingnames: proj3_2.cpp, Inventory.h, and Inventory.cpp (unless youuse just one file for both the Inventory class and main function).Upload all your files in one compressed file.

== ABSOLUTELY NO GLOBAL VARIABLES ALLOWED == (constants are fineas global)

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

More Books

Students also viewed these Programming questions

Question

In Exercises simplify the ratio of factorials. (n + 1)! n!

Answered: 1 week ago