Microsoft Visual C#
7th Edition
ISBN: 9781337102100
Author: Joyce, Farrell.
Publisher: Cengage Learning,
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 2, Problem 15E
Write a
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Write a program that generates a plate number based on the user's answer to the following questions:
1. What is your favorite color of the rainbow (ROYGVIB)?
a. Use the first letter of the chosen color as the first character of the plate number.
b. Display "Invalid Input" and ask the user to re-enter his/her answer if the answer is not a valid color of the rainbow.
2. What is your month of birth?
a.
Use the last letter of the month as the second character of the plate number.
b. Display "Invalid Input" and ask the user to re-enter his/her answer if the answer is not a valid month.
3. What is your first name?
a. Use the third letter of the first name as the third character of the plate number. No need to include the second name if you have a second name.
Make sure to use "cout" and "cin" to collect the necessary inputs from the user.
For the number section:
1. Ask the user his/her age and use the age as the first and second digits of the plate number.
a. Display "Invalid Input" and ask…
Write a program that computes the molecular weight of a carbohydrate (ingrams per mole) based on the number of hydrogen, carbon, and oxygenatoms in the molecule. The program should prompt the user to enter thenumber of hydrogen atoms, the number of carbon atoms, and the numberof oxygen atoms. The program then prints the total combined molecularweight of all the atoms based on these individual atom weights:Atom Weight(grams I mole)H 1.00794c 12.01070 15.9994For example, the molecular weight of water (H20) is: 2(1.00794) +15.9994 = 18.01528.
Write a program that calculates and prints the volume of a pyramid given the
base (b) and the height (h) of the pyramid. The formula to calculate the
volume is:
Volume = (1/3) *b * h
Enter the base of the pyramid:
3
Enter the height of the pyramid:
2
The volume is 1.9998
Chapter 2 Solutions
Microsoft Visual C#
Ch. 2 - Prob. 1RQCh. 2 - Prob. 2RQCh. 2 - Prob. 3RQCh. 2 - Assume that you have two variables declared as int...Ch. 2 - Assume that you have a variable declared as...Ch. 2 - Assume that you have a variable declared as int...Ch. 2 - Assume that you have a variable declared as int...Ch. 2 - Prob. 8RQCh. 2 - Assume that you have a variable declared as int...Ch. 2 - Assume that you have a variable declared as int...
Ch. 2 - Prob. 11RQCh. 2 - Which of the following is not a C# comparison...Ch. 2 - Prob. 13RQCh. 2 - Which of the following C# types cannot contain...Ch. 2 - Assume that you have declared a variable as double...Ch. 2 - Assume that you have declared a variable as double...Ch. 2 - When you perform arithmetic operations with...Ch. 2 - Prob. 18RQCh. 2 - Prob. 19RQCh. 2 - Which of the following compares two string...Ch. 2 - What is the numeric value of each of the following...Ch. 2 - What is the value of each of the following Boolean...Ch. 2 - Choose the best data type for each of the...Ch. 2 - In this chapter, you learned that although a...Ch. 2 - Write a C# program named InchesTOCentmeters that...Ch. 2 - Prob. 6ECh. 2 - Write a C# program named ProjectedRaises that...Ch. 2 - Convert the ProjectedRaises class to an...Ch. 2 - Malcolm Movers charges a base rate of $200 per...Ch. 2 - Prob. 10ECh. 2 - Write a program named Eggs that declares four...Ch. 2 - Modify the Eggs program to create a new one named...Ch. 2 - Write a program named MakeChange that calculates...Ch. 2 - Write a program named Testslnteractive that...Ch. 2 - Write a program named FahrenheitToCelsius that...Ch. 2 - Prob. 16ECh. 2 - Prob. 17ECh. 2 - Pig Latin is a nonsense language. To create a word...Ch. 2 - Each of the following files in the Chapter.02...Ch. 2 - In Chapter 1, you created two programs to display...Ch. 2 - Prob. 2CP
Knowledge Booster
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
- Write an application that inputs three integers from the user and displays the sum, average, product, smallest, and largest of the numbers. [Note: The calculation of the average should result in an integer representation of the average. So, if the sum of the values is 7, the average should be 2, not 2.3333….]arrow_forwardWrite a Phyton program that computes the duration of a projectile’s flight and its height above the ground when it reaches the target. As part of your solution, you should display instructions to the program user. Relevant formula: time = distancevelocity xcos (θ) height = velocity xsin x time- g x time22 use the following variables: g = gravitational constant = 32.17 = angle of elevation in radian v = velocity or the projectile velocity (ft/sec) d= distance to target t = time of flight in seconds. h = height at impact Try your program on these data sets.arrow_forwardC++arrow_forward
- Problem: Write a program that converts degrees from Celsius to Fahrenheit, using the formula:DegreesF = ( DegreesC * 9/5) + 32 Prompt the user to enter a temperature in degrees Celsius as a whole number without a fractional part. Then, havethe program display the equivalent Fahrenheit temperature, including the fractional part to at least TWO decimalplaces. A possible dialog with the user might be:Enter a temperature in degrees Celsius: 20 Problem: Write a program that determines the change to be dispensed from a vending machine. An item in themachine can cost between 25 cents and a dollar, in 5-cent increments ( 25, 30, 35, . . . . , 90, 95, 100 ), and themachine accepts only a single dollarEnter price of the item ( from 25 cents to a dollar, in 5-centincrements ): 45You bought an item for 45 cents and gave me a dollar, so your change is:2 quarters,0 dimes,1 nickel.arrow_forwardWrite a Python program that asks user to enter the month (1-12) and the year. The program should then display the number of days in that month. Use the following criteria to identify the leap year If the year is divisible by 100, then it is a leap year if and only if it is divisible by 400. Example, 2000 is a leap year and 2100 is not a leap year if the year is divisible by 100, then it is a leap year if and only if it is divisible by 4. Example, 2008 is a leap year but 2009 is not Here is a sample run of the program: Enter a month (1-12) : 2 Enter a year : 2008 2008 is a leap year and there are 29 days in the month of February. Note: You may create a function to calculate the leap year and a function to convert the month in String ( ex: 2 = February)arrow_forwardWrite a program that converts Celsius temperatures to Fahrenheit temperatures. The formula is as follows:F= 9/5C + 32The program should ask the user to enter a temperature in Celsius, and then display the temperature converted to Fahrenheit.arrow_forward
- Write a program to calculate the position of a projectile at a given time t. For an initial velocity vo and angle of departure ®g, the position is given by x and y coordinates as follows (note: the gravity constant g is 9.81 m/s²): X= V0 Cos (0)t y=vo sin (8,)t –; gt The program should initialize the variables for the initial velocity, time, and angle of departure. It should then call a function to find the x and y coordinates, and then another function to print the resultsarrow_forwardThe program that you create for this exercise will begin by reading the cost of a meal ordered at a restaurant from the user. Then your program will compute the tax and tip for the meal. Use your local tax rate when computing the amount of tax owing. Compute the tip as 18 percent of the meal amount (without the tax). The output from your program should include the tax amount, the tip amount, and the grand total for the meal including both the tax and the tip. Format the output so that all the values are displayed usingtwo decimal places.arrow_forwardPhyton The program that you create for this exercise will begin by reading the cost of a meal ordered at a restaurant from the user. Then your program will compute the tax and tip for the meal. Use your local tax rate when computing the amount of tax owing. Compute the tip as 18 percent of the meal amount (without the tax). The output from your program should include the tax amount, the tip amount, and the grand total for the meal including both the tax and the tip. Format the output so that all of the values are displayed using two decimal places.arrow_forward
- Write a program named FahrenheitToCelsius that accepts a temperature in Fahrenheit from a user and converts it to Celsius by subtracting 32 from the Fahrenheit value and multiplying the result by the double 5.0/9.0. Display both values to one decimal place.In C#arrow_forwardWrite a program named guess.cpp that generates a random number between 1 and n, where n is the upper limit of the guessing number. The program will prompt for the number n and ask the user to guess what the number is. If the user's guess is higher than the random number, the program should display "Too high, try again.". If the user's guess is lower than the random number, the program should display "Too low, try again.". The program should use a loop that repeats until the user correctly guesses the random number. Validate all user entries (see sample output). Sample Output Enter the upper limit of the guessing number: 0 Invalid input, the upper limit must be greater than 0! Enter the upper limit of the guessing number: 100 Enter your guess in between 1 and 100. 101 You have entered an invalid number! Enter your guess in between 1 and 100. 50 Too low, try again. Enter your guess in between 1 and 100. 75 Too high, try again. Enter your quess in between 1 and 100. 62 loo low, try again.…arrow_forward7. Read input an integer from the user and print whether it is "Negative"/"Positive" using the ternary operator. Programming Language: PHP MacBook Air 80 F5 F6 F7 F1 F2 F3 F4arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Constants, Variables, Data types, Keywords in C Programming Language Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=d7tdL-ZEWdE;License: Standard YouTube License, CC-BY