Question: CSCI272 Object-oriented Programming Spring 2019 Exar (30 pts) Q1: In a main function: 1) 2) (5 pts) Define two float variables: inch and cm. (Assume
CSCI272 Object-oriented Programming Spring 2019 Exar (30 pts) Q1: In a main function: 1) 2) (5 pts) Define two float variables: inch and cm. (Assume 1 inch is 2.54 cm). (10 pts) Initialize inch to 5, and display a sentence "5 inches is x cm" where x is the r of cm (15 pts) Ask the user to input a number for inch "Please input a number as inch; inp negative number to stop". 3) a. If the number is negative, stop the program b. Otherwise, display "x inches is y cm" where x is the number use inputs and the number from the converting. Then repeat 3). Below is one execution of the program: 5 inches is 12.7 cm Please input a number as inch (input negative number to stop): 2 2 inches is 5.88 cm Please input a number as inch (input negative number to stop): 2.7 2.7 inches is 6.858 cm Please input a number as inch (input negative number to stop): 2.72 2.72 inches is 6.9088 cm Please input a number as inch (input negative number to stop): -1 Program ended with exit code: e
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
