2. Write a program that converts minutes to days, hours and minutes. The program output should be as follows; Please enter value in minutes : 8924 8924 minutes is equivalent to; Days : 6 Hours : 4 Minutes : 44
Q: Write a function that converts milliseconds to hours, minutes, and seconds using the following…
A: Steps to convert milliseconds to seconds, minutes, and hours as follows Total seconds = Milli…
Q: 20. or the following code if x = 2: print ('Two or more) else : print (Something else) What value of…
A: We are given a code snippet and we will compare values of x, and statements will be printed…
Q: You were hired by PAGCOR as part of programming team in-charge of automating its BINGO game. Your…
A: Step 1: Accept Number n form user Step 2: if Number between 1 to 15 the print "That's Letter 'B' in…
Q: Write a program that calculates and prints the amount of wages due to an employee for a week's work.…
A: C++ program to calculate the amount of wages due to an employee for a week’s work. Prompt the user…
Q: I'm stuck on this problem, and here's what I'm stumped on: Meadowdale Dairy Farm sells organic brown…
A: The Answer is
Q: Q3: Write a VB program to enter a mark of a student and then find his grade as follows: If mark >=…
A: Get input from user and convert it to integer. Chek the input with all conditions and print output…
Q: 5. Prompt the user to enter the values of two double variables and print "True" in the output if the…
A: start Input two double values check if these two values in between 0 and 1 if yes print True else…
Q: The power of the microwave can be calculated as follows: Power=Work/Time Work is measured in joules…
A: code: #include<iostream> using namespace std; //main method int main() { //variable…
Q: 2. Write a program for the Air Force to label an aircraft as military or civilian. The program is to…
A: Here is the approach : Create the two integers to take input for the plane speed and the plane…
Q: Write a program which takes two numbers as input from user and determines which is the larger of the…
A: The above program is solved using MIPS MARS below:
Q: 2- Write a Python program that determines a student’s grade. The program will read three types of…
A: here in this question we have asked to write a program which three score as input and based on…
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both…
A: PROGRAM: //Importing the required header file import java.util.Scanner; //Defining the class…
Q: "Write a program that computes the amount of calories burned when you run. Your program should ask…
A: Algorithm: 1. Take input as duration,speed,weight. 2. Initialize MET to 0. 3. Make MET=8 if speed is…
Q: Write a program that determines a student's grade. The program will read three types of scores…
A: The program is written in C++ Language. Check the program screenshot for the correct indentation.…
Q: Write a program that reads in two numbers a and b. The program should calculate the following…
A: The above program calculate a2 using the pow function in c++. Square root can be find using the sqrt…
Q: Write a program that prompts the user to enter an integer between1 and 12 and then displays the name…
A: Program approach: Input an integer between 1 and 12. Displays the name of the month that…
Q: Void Do1 (int: &, a. int &b) { a = 5; a = a + b; b = a + 2; } Int main() {…
A: We have given a C++ code and in which pass variable by reference. Here, integer variable x pass by…
Q: 1. Create a program that asks for a distance in kilometers and converts it into its metric…
A: /*C program to ask distance in kilometers and converts it into its meter equivalent*/ #include…
Q: Write the exact output that you expect to see on the screen when the indicated statements are…
A: The output will be 9 Explanation:- In the given program, a are initialized with 39 and b are…
Q: Suppose x, y, z, and w are int variables. What value is assigned to each of these variables after…
A: Let us number the statements as follows: x = 7; y = 2 * x - 3; z = x + y - 3; x = z / y; y = z - x;…
Q: 2. Write a program that converts minutes to days, hours and minutes. The program output should be as…
A: Days = inputMinutes / 1440;Hours = inputMinutes / 60;Mins = inputMinutes % 60;
Q: Write a program that converts "kilometers per hour" to "miles per hour". miles = (kilometers…
A: Hi. As there is no language mentioned, I will attempt this question using Python. Let's move on…
Q: Write the exact output that you expect to see on the screen when the indicated statements are…
A: The write() method of Java PrintStream class writes len bytes
Q: Driving is expensive. Write a program with a carsiles/gallon and gas dollars gallon (both floats) as…
A: C++ programming language is used to answer the given question. The formula to calculate the cost of…
Q: Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output…
A: import java.util.*;public class LabProgram { public static void main(String args[]) { Scanner sc =…
Q: Write a program that takes your full name as input and displays the abbreviations of the first and…
A: 1- Note: Since you have not provided the language to write the code so I am using java language to…
Q: Write a program that reads two numbers from the keyboard representing, respectively, an investment…
A: the answer is given below:-
Q: Suppose that x, y, z, and w are int variables and x = 25, y = 3, z = 12, and w = 4. What is the…
A: a. Program: //include the header file #include <iostream> using namespace std; //definition…
Q: | Create a program which prompts the user for a Celsius temperature and convert the I temperature…
A: As no language is specified, here C language has been used to design the code. The code and the…
Q: 3. Write a program that computes and interprets the Body Mass Index (BMI). The program prompts the…
A: Take two inputs from user for height and weight convert height in meter(h*0.0254) and weight in…
Q: Write a program that reads from the user the initial Kilometers of the car, the current Kilometers…
A: Java program for the above fuel consumption problem is given below in step 2.
Q: Write a program that computes and interprets the Body Mass Index (BMI). The program prompts the user…
A: Start Input weight in pounds Input height in inches Convert weight to kilograms Convert height to…
Q: Write a program that converts minutes to days, hours and minutes. The program output should be as…
A: program to convert minutes to days, hours and minutes is given below. note: As the language is not…
Q: d) Read input an integer t from the user and print the value of the function t*sin(t) + cos(t) in…
A: Write a program in MATLAB to read input an integer t from the user and print the value of the…
Q: Write the exact output that you expect to see on the screen when the indicated statements are…
A: answer along with output and code screenshot is given below
Q: Write a program that repeatedly prompts a student to enter grade points (on a scale of 0-4) and…
A: Please find the answer below :
Q: Write a program that allows the user to input their weight in, height in feet, age in years, and…
A: Body mass index is a person's weight in kilograms divided by the square of height in meters.
Q: program that prompts the user to enter an integer. If the number is a multiple of 5, print HiFive.…
A: As programming language is not mentioned, so we are providing answer in C++ language.
Q: is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as…
A: Answer:
Q: Write the exact output that you expect to see on the screen when the indicated statements are…
A: The code snippet is executed as a part of complete program and is given below along with output We…
Q: Write a program that reads the following information and prints payroll statements. These are the…
A: <?php //getting full name from user $fullname = readline('Enter fullname : ');…
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both…
A: Actually, the given program is: Output each floating-point value with two digits after the decimal…
Q: write a single code line to print the value of an integer variable called H *
A: Code: As no language is specified providing the code in c++ #include <iostream>using namespace…
Q: 2. Create a program that will accept 10 scores and will display the MAXIMUM SCORE. USE JAVA…
A: A program that accepts 10 numbers, will accept it in an array. It will only print the maximum score…
Q: Write the exact output that you expect to see on the screen when the indicated statements are…
A: Given code: int score = 18; score= 3 score - 15; System.out.println(score);
Q: • Write a program that computes the average of 5 students grades which are entered by the user.…
A: Please find the answer below :
Q: Write a program that reads from the user the initial Kilometers of the car, the current Kilometers…
A: Required: Write a program that reads from the user the initial Kilometers of the car, the current…
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both…
A: import java.util.*;public class LabProgram { public static void main(String[] args) { Scanner scan…
Q: Write a program that asks the user to enter a positive integer, as in the examples below. If the…
A: while True:#infinite loop is used, so that it can run until proper input is given try: n =…
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
C-PROGRAM :Q2
Step by step
Solved in 3 steps with 1 images
- a. Write a program named CheckMonth that prompts a user to enter a birth month. If the value entered is greater than 12 or less than 1, display an error message; otherwise, display the valid month with a message such as 3 is a valid month. b. Write a program named CheckM0nth2 that prompts a user to enter a birth month and day. Display an error message if the month is invalid (not I through 12) or the day is invalid for the month (for example, not between 1 and 31 for January or between I and 29 for February). If the month and day are valid, display them with a message.Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles. Output each floating-point value with two digits after the decimal point, which can be achieved by executingcout << fixed << setprecision(2); once before all other cout statements. Ex: If the input is: 20.0 3.1599 the output is: 3.16 11.85 79.00Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:System.out.printf("%.2f", yourValue); The output ends with a new line. Ex: If the input is: 20.0 3.1599 the output is: 3.16 11.85 79.00 For some reason my code is not functioning for all inputs to display the requested outputs. this is my code used: import java.util.Scanner; public class LabProgram {public static void main(String[] args) { Scanner sc = new Scanner(System.in);double n1 = sc.nextDouble();double n2 = sc.nextDouble();double product1 = n2*20/20;double product2 = n2*75/20;double product3 = n2*500/20;System.out.printf("%.2f %.2f %.2f",product1,product2,product3);System.out.println();}} this one is showing correctly: Input 20.0 3.1599 Your output 3.16 11.85 79.00 Expected output 3.16 11.85…
- Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:System.out.printf("%.2f", yourValue); The output ends with a newline. Ex: If the input is: 20.0 3.1599 the output is: 3.16 11.85 79.00Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:System.out.printf("%.2f", yourValue); The output ends with a newline.2. Create a program that will accept 10 scores and will display the MAXIMUM SCORE. USE JAVA PROGRAMMING
- Modify the provided code for the program that calculate the overtime hours to:a. calculate the weekly pay for week 1 and week 2 and b. then add them up to calculate the total pay earned for 2 weeks,c. then calculate the amount of taxes withheld based on 18% of the earned pay and d. finally calculate the net pay and display the earned pay, taxeswithheld and the net pay (see the output below) CODE: def calcWeeklyWages(totalHours, hourlyWage):# return the total weekly wages for a worked working totalHours,# with a given regular hourlyWage. Include overtime for hours over 40if totalHours <= 40:totalWages = hourlyWage*totalHoursprint("you had no overtime hours this week")else:overtime = totalHours - 40totalWages = hourlyWage*40 + (1.5*hourlyWage)*overtimeprint("your overtime hours this week are: ", overtime, "hours")return totalWages# main program (that you will need to modify)hours = float(input('Enter hours worked: '))wage = float(input('Enter dollars paid per hour: '))total =…Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:System.out.printf("%.2f", yourValue); The output ends with a newline. Ex: If the input is: 20.0 3.1599 the output is: 3.16 11.85 79.00 Note: Real per-mile cost would also include maintenance and depreciation.1. Federal law requires that hourly employees be paid “time-and-a-half” for work in excess of 40 hours in a week.For example, if a person’s hourly wage is $12 and he or she works 60 hours in a week, the person’s gross pay shouldbe (40 *12) + (1.5 *12 * (60-40)) = $840.Write a program that requests the floating number of hours a person works in a given week and the person’s hourlywage as input, and then displays the person’s gross pay. Save it as overtimePay.py
- 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.Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles. Output each floating-point value with two digits after the decimal point, which can be achieved by executingcout << fixed << setprecision(2); once before all other cout statements. Ex: If the input is: 20.0 3.1599 the output is: 3.16 11.85 79.00 Note: Real per-mile cost would also include maintenance and depreciation.Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:System.out.printf("%.2f", yourValue);