Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your goal here is to fulfill make a program that would convert feet to inches, and inches to centimeter. In fact, we are going to

Your goal here is to fulfill make a program that would convert feet to inches, and inches to centimeter. In fact, we are going to use your own personal data about yourself regarding your height. For example, if you are 5 feet and 4 inches. Then you are 64 inches tall since 5 feet is 5x12 inches which is 60 and then plus 4 inches for a total of 4 inches. And converting that to centimeters you are 162.56 centimeters long since 1 inch is equivalent to 2.54 centimeters. The figures here are only an example, yours could be different. So, thus your goal here is to fulfill the following requirements in your C++ program. Each of the requirement below is worth 3 points for a total of 45 points for this exercise.

a.Declare a constant that would store a value of 12 for feet to inches conversion. You have the freedom to give it the name that you like. The 12 here means one foot is equivalent to 12 inches.

b.Declare a constant that would store a value of 2.54 for inches to centimeter conversion. You have the freedom to give it the name that you like. The 2.54 here means one inch is equivalent to 2.54 centimeters.

c.Declare variables for feet and inches for your height.

d.Declare a variable for total inches for the conversion of your height to total inches.

e.Declare a variable for total centimeters for the conversion of your height to total centimeters.

f.Declare a variable that would store or initialize your whole name.

g.After the declaration store your height in feet in the feet variable that you declared earlier (letter c). For example, if you are 5 feet and 4 inches then you store 5 to that variable.

h.After the declaration store your height in inches in the inches variable that you declared earlier (letter c). For example, if you are 5 feet and 4 inches then you store 4 to that variable.

i.For your total inches conversion, multiply your constant for feet to inches conversion (letter a) with your variable for feet (letter c) and then add the inches (letter c) variable to that expression and finally store it to your total inches variable (letter d). This should be only in one line not multiple lines.

j.For your total centimeters conversion, multiply your constant for inches to centimeters conversion (letter b) with your variable for total inches (letter d) and then store it to your total centimeters variable (letter e). This should be only in one line not multiple lines.

k.Using cout the display the number of feet and inches and its conversion to total inches. Use all the variables needed to display in your cout, not the literal values. Check the possible output below. Your output of course can be different than this one given your own personal information.

oMy height is 5 feet and 4 inches which is 64 inches in total.

l.Using cout the display the number of total inches and its conversion to total centimeters. Just like above use all the variables needed to display in your cout, not the literal values. Check the possible output below. Your output again can be different than this one given your own personal information.

oMy height is 64 inches in total which is equivalent to 162.56 centimeters.

m.Using cout display the third letter of your name and then cout it like below with preceding text like "The third letter of my name..". Again, your output could be different than mine.

oThe third letter of my name is letter p.

n.Using cout display the length of your name and then cout it like below with preceding text like "My name contains..". Again, your output could be different than mine. Check the example below for reference.

oMy name contains 12 letters including space.

o.Using cout and the escape sequence for new line (2 new lines) display your name like below. Use the variable for your name to display your name.

oThis program is made by : John Doe

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions