Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

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 Databases questions

Question

8. What values do you want others to associate you with?

Answered: 1 week ago

Question

4. Label problematic uses of language and their remedies

Answered: 1 week ago