Microsoft Visual C#
Microsoft Visual C#
7th Edition
ISBN: 9781337102100
Author: Joyce, Farrell.
Publisher: Cengage Learning,
bartleby

Concept explainers

Question
Book Icon
Chapter 2, Problem 6E
Program Plan Intro

Program Plan:

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.

Blurred answer
Students have asked these similar questions
Convert the Inches ToCentimeters program to an interactive application named Inches ToCentimeterslnteractive. Instead of assigning a value to the inches variable, accept the value from the user as input. Display the measurement in both inches and centimeters-for example, if inches is input as 3, the output should be: 3 inches is 7.62 centimeters.
Convert the InchesToCentimeters program to an interactive application named InchesToCentimeterslnteractive. Instead of assigning a value to the inches variable, accept the value from the user as input. Display the measurement in both inches and centimeters—for example, if inches is input as 3, the output should be: 3 inches is 7.62 centimeters.
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/2 mv2In 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.

Chapter 2 Solutions

Microsoft Visual C#

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    Microsoft Visual C#
    Computer Science
    ISBN:9781337102100
    Author:Joyce, Farrell.
    Publisher:Cengage Learning,
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,