Details
This set of problems and coding challenges are to be done in lab and at home.
All the cpp files from this assignment should be in a folder.
The name of the folder should follow this format:
lastName_firstName_#1
For example, my name is Alex Chen, folder name will be "Chen_Alex_#1"
Failure to follow this naming convention will result in your assignment not being graded.
The folder is to be zipped and submitted on blackboard on the due date.
#1
Write a hello.cpp that prints out Hello World when executed
#2
Write a hello2.cpp that prints Hello and then your first and last name on a seperate line.
For example:
Hello
Alex Chen
#3
Write the following program with the file name hello3.cpp
- Ask the user to enter his/her name, birth year, and height in inches. Store them in a string variable and 2 int variables.
- Calculate the user's (approximate) age, and the user's height in centimeters.
- Print the following message:
Hello [First Name Last Name],
You are [age] years old.
You are about [height].
#4
Write a cost.cpp program that does the following:
- Ask the user to enter the price of product A and product B. Store them as doubles.
- Print the total cost, including sales tax. Assume the tax rate is 8.875%.
#5
Write a lastDigit.cpp program that does the following:
- Ask the user to enter any number
- Print the last digit of that number
- Remove the last from that number and print out the new number
#6
Write a area.cpp project that does the following:
- Ask the user to enter the base and height of a right triangle, and store them as doubles.
- Print the area of the triangle. Use the formula area = 1/2 * base * height to calculate it.
- Ask the user to enter his/her height in inches, and store it as an int.
- Print the user's height in feet and inches. Use the division and modulo operations to calculate them.
Enter the base of the right triangle: 3.5
Enter the height of the right triangle: 4
The area is 7
How many inches tall are you? 70
That is 5 feet and 10 inches