Concept explainers
Write a
DegreesC = 5(DegreesF - 32)/9
Prompt the user to enter a temperature in degrees Fahrenheit as a whole number without a fractional part. Then have the program display the equivalent Celsius temperature, including the fractional part to at least one decimal point. A possible dialogue with the user might be
Enter a temperature in degrees Fahrenheit: 72
72 degrees Fahrenheit is 22.2 degrees Celsius.
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
Java: An Introduction to Problem Solving and Programming (7th Edition)
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Concepts of Programming Languages (11th Edition)
Java How To Program (Early Objects)
Absolute Java (6th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Web Development and Design Foundations with HTML5 (8th Edition)
- Write a program that prompts the user to input three (3) integers: MM, DD, and YYYY. For example, 07 26 1998. The program will print the number of days elapsed from 01 January of that year, i.e. January 1st is always 1 and December 31 is either 365 or 366, depending on if leap year or not.arrow_forwardWrite a program that prompts the user to enter an integer between1 and 12 and then displays the name of the month that corresponds to the integerentered by the user. For example, if the user enters three, the program shoulddisplay March.arrow_forwardWrite a program that asks for the starting time and the number of minutes of the call, and displays the charges. The program should ask for the time to be entered as a floating-point number in the form HH.MM. For example, 07:00 hours will be entered as 07.00, and 16:28 hours will be entered as 16.28.arrow_forward
- 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…arrow_forwardWrite a program that asks the user for two positive integers between 2 and 10 to use for the length and width of a rectangle. If the numbers are different, the larger of the two numbers should be used for the length and the smaller for the width. The program should then display a rectangle of this size on the screen using the character ‘X’. For example, if the user enters either 2 5 or 5 2, the program should display the following:arrow_forwardWrite a program that prompts the user to enter an integer for today’s day of the week (Sunday is 0, Monday is 1, ..., and Saturday is 6). Also prompt the user to enter the number of days after today for a future day and display the future day of the week.arrow_forward
- Write a program that calculates the estimated hours and minutes for a trip given the number of miles traveled and the speed in miles per hour. Specifically, write a program that Welcomes the user to the Travel Time Calculator. Asks user for number of miles traveled(allow user to enter fractional values) Asks user for the speed in miles per hour (allow user to enter fractional values) Calculates the number of hours and minutes for the trip to the nearest integer value. Hint: You can use the built-in function round that rounds a given number to the rounded integer value. e.g. round(4) will return 4, round(4.125) will return 4, round(4.5) will return 4 and round (4.75) will return 5. Prints the number of hours and minutes for the trip. Here are some sample runs:arrow_forwardWrite a program that asks the user for a 24-hour time, then displays the time in 12-hour form: Enter a 24-hour time: 21:11 Equivalent 12-hour time: 9:11 PM Be careful not to display 12:00 as 0:00.arrow_forwardWrite a program that prompts the user to enter an integer. If the number is a multiple of 5, print HiFive. If the number is divisible by 2, print HiEven.arrow_forward
- Write 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 prompts the user to enterthe month and year and displays the number of days in the month. For example, ifthe user entered month 2 and year 2012, the program should display that February2012 has 29 days. If the user entered month 3 and year 2015, the program shoulddisplay that March 2015 has 31 days.arrow_forwardWrite a program that reads a four-digit number from user, then the program separates digits of the number e.g., 4567 to be displayed as:4567arrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,