Concept explainers
Following variables are used in the program:
TotalJobMinutes: To the total job minutes value.
Hours: To store the number of hours.
Minutes: To store the number of minutes
Following functions are used in the program:
WriteLine(): To display the hours and minutes value for given total job minutes.
ReadKey(): To end the program after reading a random variable.
Summary Introduction:
Program will use Main() in which value of total minutes involved in a job is stored in variable TotalJobMinutes. Using this value of TotalJobMinutes, number of hours and minutes in it are calculated as quotient and remainder obtained on dividing it by 60 respectively. The value of hours and minutes is then displayed to user using WriteLine() method.
Program Description:
Purpose of the program is to represent the total minutes involved in a job in hours and minutes format.
Trending nowThis is a popular solution!
Chapter 2 Solutions
Microsoft Visual C#
- Write a program named Eggs that declares four variables to hold the number of eggs produced in a month by each of four chickens, and assign a value to each variable. Sum the eggs, then display the total in dozens and eggs. For example, a total of 127 eggs is 10 dozen and 7 eggs.arrow_forwardWrite an application that prompts for and reads "double" value representing a monetary amount. Then determine the fewest number of each bill and coin needed to represent that amount, starting with the highest (assuming that a ten-dollar bill is the maximum size needed). For example, if the value entered is 47.63, then the program should print the equivalent amount as:4 ten dollar bills1 five dollar bills2 one dollar bills2 quarters1 dimes0 nickels3 pennies Using your Eclipse / Java integrated development environment (IDE), develop and code a solution to Programming Project 2.11 from pages 94-95 of the text book.arrow_forwardThe temperature of an object changes when it absorbs or loses thermal energy. It is possible to relate the amount of heat transferred, denoted by a variable q with units of joules, to the quantity of the substance m, by the following equation: q = mCsΔt Write a script that calculates amount of heat transferred for any amount of aluminum. Aluminum has a specific heat Cs = 0.897. The program should prompt the user to enter values for Δt and m, and should return the amount of heat transferred in units of joules. Test the program with values of 20 ℃ and 100 g.arrow_forward
- Write an application that allows a user to enter any number of student quiz scores, as integers, until the user enters 99. If the score entered is less than O or more than 10, display Score must be between 10 and O and do not use the score. After all the scores have been entered, display the number of valid scores entered, the highest score, the lowest score, and the arithmetic average. An example of the program is shown below: Enter a score >> 6 Enter another score or 99 to quit >>» 7 Enter another score or 99 to quit >» 9 Enter another score or 99 to quit >» 7 Enter another score or 99 to quit >> 99 4 valid scores were entered Highest was 9 Lowest was 6 Average was 7.25arrow_forwardWrite a program that calculates and displays a person’s body mass index (BMI). The BMI is often used to determine whether a person with a sedentary lifestyle is overweight or underweight for his or her height. A person’s BMI is calculated with the following formula:BMI = weight × 703 / height2where weight is measured in pounds and height is measured in inches. The program should display a message indicating whether the person has optimal weight, is underweight, or is overweight. A sedentary person’s weight is considered to be optimal if his or her BMI is between 18.5 and 25. If the BMI is less than 18.5, the person is considered to be underweight. If the BMI value is greater than 25, the person is considered to be overweight please write code on c++arrow_forwardWrite a program that calculates the future value of an investment at a given interest rate for a specified number of years. The formula for the calculation is as follows:futureValue = investmentAmount * (1 + monthlyInterestRate)years * 12 Use text fields for users to enter the investment amount, years, and interest rate. Display the future amount in a text field when the user clicks the Calculate button, as shown in Figure 9.22b.arrow_forward
- Assume that the population of Mexico is 128 million and the population of the United States is 323 million. Write a program called Population that accepts two values from a user: an assumption of an annual increase in the population of Mexico and an assumption for an annual decrease in the U.S. population. Accept both figures as percentages; in other words, a 1.5 percent decrease is entered as 0.015. Write an application that displays the populations of the two countries every year until the population of Mexico exceeds that of the United States, and display the number of years it took. An example of the program is shown below: Enter the percent annual increase for Mexico population Enter as a decimal. For example, 0.5% is entered as 0.005 Enter the value >> 0.008 Enter the percent annual decrease for U.S. population Enter as a decimal. For example, 0.5% is entered as 0.005 Enter the value >> 0.002 Mexico population U.S. Population 1 129.024 million 322.354 million 2…arrow_forwardPlease put comment at each step of the programarrow_forwardWrite a program that displays a simulated paycheck. The program should ask the user to enter the date, the payee’s name, and the amount of the check. It should then display a simulated check with the dollar amount spelled out, as shown here: Date: 12/24/2012 Pay to the Order of: John Phillips $1920.85 One thousand nine hundred twenty and 85 cents You may assume the amount is no greater than $10000. Be sure to format the numeric value of the check in fixed-point notation with two decimal places of precision. Be sure the decimal place always displays, even when the number is zero or has no fractional part. Use either C-strings or string class objects in this program.arrow_forward
- Write a program that calculates the future value of an investment at a given interest rate for a specified number of years. The formula for the calculation is: futureValue = investmentAmount * (1 + monthlyInterestRate)years*12 Use text fields for the investment amount, number of years, and annual interest rate. Display the future amount in a text field when the user clicks the Calculate button,arrow_forwardWrite a program that declares a named constant to hold the number of quarts in a gallon (4). Also declare a variable to represent the number of quarts needed for a painting job, and assign an appropriate value—for example, 18. Compute and display the number of gallons and quarts needed for the job. Display explanatory text with the values—for example, A job that needs 18 quarts requires 4 gallons plus 2 quarts. Save the program as QuartsToGallons.java. Convert the QuartsToGallons program to an interactive application. Instead of assigning a value to the number of quarts, accept the value from the user as input. Save the revised program as QuartsToGallonsInteractive.java.arrow_forwardWrite a program that generates a random number in the range of 1 through 100, and asks 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." If the user guesses the number, the application should congratulate the user and generate a new random number so the game can start over. Additional Enhancement: Enhance the game so it keeps count of the number of guesses that the user makes. When the user correctly guesses the random number, the program should display the number of guesses.arrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT