Concept explainers
List of variables:
CENTIMETERS_IN_INCH: Stores centimeter to inches conversion factor,i.e,. 2.54.
userInput: Takes string input from user.
inch: Store inches value
centi: Store converted value in centimeter
List of functions used:
Write(): To display instructions in string to user,
ReadLine(): To read input from user in string format.
double.TryParse(): To convert the entered string into double.
ReadKey(): To end the program after reading a random variable.
Summary Introduction:
Program will use Main () method to prompt the user to enter a value in inches. This value is then converted to centimeter using CENTIMETER_IN_INCH variable which stores a constant value of 2.45(conversion factor).The converted value is displayed to user on console.
Program Description:
Purpose of program is to take value in inches and display it in centimeters.
Trending nowThis is a popular solution!
Chapter 2 Solutions
Microsoft Visual C#
- For each of the following exercises, you may choose to write a console-based or GUI application, or both. Write a program for The Carefree Resort named ResortPrices that prompts the user to enter the number of days for a resort stay. Then display the price per night and the total price. Nightly rates are $200 for one or two nights; $180 for three or four nights; $160 for five, six, or seven nights; and $145 for eight nights or more.arrow_forwardKinetic Energy In physics, an object that is in motion is said to have kinetic energy. The following formula can be used to determine a moving object’s kinetic energy: KE =1/2mv2 In the formula KE is the kinetic energy, m is the object’s mass in kilograms, and v is the object’s velocity in meters per second. Create an application that allows the user to enter an object’s mass and velocity and then displays the object’s kinetic energy. The application should have a method named KineticEnergy that accepts an object’s mass (in kilograms) and velocity (in meters per second) as arguments. The method should return the amount of kinetic energy that the object has.arrow_forwardQl:-Write a program in visual basic that calculate the average value of thee integer numbers. Use four text boxes for the numbers and the result and one command botton for execution.arrow_forward
- JAVA Create an application that allows you to enter the amount of purchase and then display the amount of sales tax on that purchase. Use a slider to adjust the tax rate between 0% and 10%. an example run of the programarrow_forwardwrite VB codearrow_forwardThe outcome of an application's computation should be saved in a variable. True or False?arrow_forward
- You’ll create both pseudocode and a flowchart to design an application that displays the following menu: Select a Planet 1. Mercury2. Venus3. Earth4. Mars5. Exit the programEnter your selection. When the user selects a planet from the menu, the program should display the following information about the planet: Mercury Average distance from the sun 57.9 million kilometers Mass 3.31 × 10^23kg Surface temperature –173 to 430 degrees Celsius Venus Average distance from the sun 108.2 million kilometers Mass 4.87 × 10^24kg Surface temperature 472 degrees Celsius Earth Average distance from the sun 149.6 million kilometers Mass 5.967 × 10^24kg Surface temperature –50 to 50 degrees Celsius Mars Average distance from the sun 227.9 million kilometers Mass 0.6424 × 10^24kg Surface temperature –140 to 20 degrees Celsiusarrow_forwardCreate an application that calculates a car’s gas mileage. The formula for calculating the miles that a car can travel per gallon of gas is: MPG=milesgallonsIn the formula MPG is miles-per-gallon, miles is the number of miles that can be driven on a full tank of gas, and gallons is the number of gallons that the tank holds. The application’s form should have TextBox controls that let the user enter the number of gallons of gas the tank holds and the number of miles the car can be driven on a full tank. When the Calculate MPG button is clicked, the application should display the number of miles that the car can be driven per gallon of gas. The form should also have a Clear button that clears the input and results, and an Exit button that ends the application. If the user fails to enter numeric values, display an appropriate error message and do not attempt to perform calculations.arrow_forwardYou’ll create both pseudocode and a flowchart to design an application that displays the following menu: Select a Planet 1. Mercury2. Venus3. Earth4. Mars5. Exit the programEnter your selection. Mercury Average distance from the sun 57.9 million kilometers Mass 3.31 × 10^23kg Surface temperature –173 to 430 degrees Celsiusarrow_forward
- In Chapter 2, you created an interactive application named GreenvilleRevenue, and in Chapter 3 you created a GUI version of the application named GreenvilleRevenueGUI. The programs prompt a user for the number of contestants entered in this years and last years Greenville Idol competition, and then they display the revenue expected for this years competition if each contestant pays a $25 entrance fee. The programs also display a statement that compares the number of contestants each year. Now, replace that statement with one of the following messages: If the competition has more than twice as many contestants as last year, display The competition is more than twice as big this year! If the competition is bigger than last years but not more than twice as big, display The competition is bigger than ever! If the competition is smaller than last years, display, A tighter race this year! Come out and cast your vote!arrow_forwardFor each of the following exercises, you may choose to write a console-based or GUI application, or both. Write a program named TestScoreList that accepts eight int values representing student test scores. Display each of the values along with a message that indicates how far it is from the average.arrow_forwardAccount numbers sometimes contain a check digit that is the result of a mathematical calculation. The inclusion of the digit in an account number helps ascertain whether the number is a valid one. Write an application named CheckDigit that asks a user to enter a four-digit account number and determines whether it is a valid number. The number is valid if the fourth digit is the remainder when the number represented by the first three digits of the four-digit number is divided by 7. For example, 7770 is valid, because 0 is the remainder when 777 is divided by 7. The next problems rely on the generation of a random number. You can create a random number that is at least mi n but less than max using the following statements: Random ranNumberCenerator = new Random(); int randomNumber; randomNumber = ranNumberGenerator .Next(min, max);arrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,