2. Trace and write the output of the following program segments. Justify your answer. int y = 30; if (y > 20 || y > 60) cout<<" work hard" << endl; if (y < 35 && y < y*2) cout<<"Dream big"<= y) cout<<"just do it" << endl;
Q: Q#1 (a). Write a program that inputs radius and user choice. It calculates volume of a sphere using…
A: Program Approach: Including necessary header files and defining the value of pi. Using namespace…
Q: Q3: The volume of a circular cylinder V=rtr?h, write a program to compute the volume if r=8m and…
A: Objective: This program designs a class to create cylinders for a given height and radius. The…
Q: 3.4 LAB: Seasons Write a program that takes a date as input and outputs the date's season in the…
A: complete answer is solved using C++ Programming Language.
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: Java
A: Program: //Import necessary packages import java.util.Scanner; //Define a class named Months public…
Q: a. Read the day as a string input and the weather in Celsius as integer input. b. Convert the…
A: Since there is no programming language is mentioned, i have used c++ for solution
Q: Q.2/ Write a program to enter a value of x and compute the value of y x if x20 |-x if x<0 where y =
A: Task :- Write a program according to the given function.As programming language is not specified,…
Q: Q1/ Write a program to enter a value of x and compute the value of y (xif x > 0 (-x if x < 0 Where y…
A: Define variable x and y for user input x ← Take user input if x>=0 y ← x else y ← -x…
Q: Expression for calories burned during workout The following equations estimate the calories burned…
A: #Code in Python Input :age (years)weight (pounds)heart rate (beats per minute)time (minutes) Output…
Q: H.W Write a program receives student's marks (8 marks) and evaluates the If 50<-average<60 print…
A: #include<iostream.h>#include<conio.h>void main(){int…
Q: Write two scnr.nextInt statements to get input values into birthMonth and birthYear. Then write a…
A: for input use scanner class
Q: Q2: Write a program to compute and display a person's weekly salary as determined by the following…
A: Since no programming language is mentioned, I am using python. Algorithm: Start Read no.of hours n…
Q: 2.12 LAB: Divide by x Write a program using integers user_num and x as input, and output user_num…
A: Required: python Write a program using integers user_num and x as input, and output user_num divided…
Q: Questlon Two: Write a C+ program to calculate the average of five student grades, then print "A+" if…
A: Output 1: Output 2: Output 3: Output 4:
Q: //////////// //////////// //////////// how do i solve this problem in java. please do not use…
A: Program Instructions:Use scanner class object to get the user input.Use if-else statements to print…
Q: Q3/ Choose True or False 1. The output of this program is 20? a) True int main(){ b) False int a; a…
A: Note - As per the guidelines we are only allowed to answer 1 question with 3 sub-parts at a time.…
Q: 3. Make a program that the user is prompted to choose whether the conversion is from degree Celcius…
A: #include <stdio.h> int main() { char ch; // Declare character for Calcius or Fahrenheit…
Q: (a) Assume x, y and z are integer variables and x = 5 and y = 6. Trace and write the values of the…
A: Dear Student, In the case of post increment, it assigns to a variable first, then increases the…
Q: Q3: Write a VB program to enter a mark of a student and then find his grade as If mark >=75 print…
A: Algorithm 1.create one module name is marks 2.enter student name marks 3.calculate total marks…
Q: Q1) Write a program that takes as input any change expressed in Saudi Riyals. It should then compute…
A: //Note: Always the language of code in which you want the result. //For Now I am doing this in java…
Q: 2.14 LAB: Expression for calories burned during workout The following equations estimate the…
A: as per Bartleby guidelines we are supposed to answer?️ only one question. Kindly repost other…
Q: Suppose x and y are int variables and symbol is a char variable. Assume the following input data: 4.…
A: According to the Question below the Solution:
Q: 1. If a=1, b=2, and c=3, what are the values of a, b and c at the end of the following program…
A: As per our guidelines we are supposed to answer only one question. Kindly repost other questions as…
Q: Q5.Write C++ program to compute and display a person's weekly salary as determined by the following…
A: Objective: A program should be written to calculate a person's weekly salary when the number of…
Q: 20.2 LAB: Convert from seconds People find it easier to read time in hours, minutes, and seconds…
A: Given Question: To write a python program.
Q: If you have the following statements: int i=12, j=4; while (i>=1) { if (( 1%2 ) == 0) cout<<i<<',";…
A: Ans =option 3 12,10,8,6,4
Q: A retail company must file a monthly sales tax report listing the sales for the month and the amount…
A: Question. A retail company must file a monthly sales tax report listing the sales for the month and…
Q: Q4; Write a program to enter a value of x and compute the value of y Where 2(X? + 15) when X >0 Y =…
A: Input : Value of X Output : Value of Y
Q: 5. The following formula can be used to describe the dimensions of a loading ramp: h sin(0) where e…
A: Note: Answering in python as language is mentioned. Input : Inclination angle Height Output :…
Q: 3.7 LAB: Output range with increment of 10 Write a program whose input is two integers, and…
A: The complete answer in Java programming language is given below:
Q: Q1. Write a program in which the output of the program should be the performance result of a student…
A: Program description: n is the user input integer variable that is used to take from the user the…
Q: a) Suppose a = 5. After the statement ++a; executes, the value of a is?
A: a) if a=5 then after execution of ++a value of a will be 6. ++a is called pre- incrementation, and…
Q: 2. Create a program using nested if else statement that would identify if the number inputted by…
A: Nested if-else statement are selection statement which is used for the decision taking process in…
Q: 5.15 LAB: Output range with increment of 5 Write a program whose input is two integers. Output the…
A: According to the information given:- We have to create a program in that we take 2 integer value…
Q: Write C++ program to compute and display a person’s weekly salary as determined by the following…
A: #include <iostream>using namespace std;int main(int argc, char const *argv[]){ int workHours;…
Q: Complete the program to read the needed values from input, that the existing output statement(s) can…
A: here is Programming Language is not mentioned so I will provide answers in c++ language. Code:…
Q: Write a program calculating the area of a triangle with the length of the three sides as a, b, c,…
A: Task :- Write a program to calculate the Area of given triangle . C++ program :- #include…
Q: The East Coast sales division of a company generates 62 percent of total sales. Based on that…
A: CODE:- #include <iostream>using namespace std; int main(){ double PoTS = .62,…
Q: (c) You are required to create a program that reads a letter of the alphabet from the user. If the…
A: We want to check if the letter input is vowel or not, for y we have added a check, and printed…
Q: Write two scnr.nextInt statements to get input values into birthMonth and birthYear. Then write a…
A: Given: Write two scnr.nextInt statements to get input values into birthMonth and birthYear. Then…
Q: Q2. Write a program to calculate tax collection according to the following formula: 10.5 % Tax, if…
A: Hello Student. Warm welcome from my side. Hope you are doing great. Here's your answer. Since you…
Q: Write C++ to determine a student's mark. The program will read a student' average (M) and determine…
A: Here is your C++ program with an output.
Q: A person is eligible to be a US senator if they are at least 30 years and have been a US citizen for…
A: ''' If age < 25: Not eligible for anything. Else If age >= 30: If…
Q: 2.21 LAB: Expression for calories burned during workout The following equation estimates the average…
A: Find the required code in java given as below and output :
Q: Q2) Write a program to calculate the average of the semester. To find the average of the semester,…
A: import java.util.*;public class Main{ public static void main(String[] args) { int a=0,b=0,c,d;…
Q: Suppose we add $100 to a checking account in year 1, $200 in year 2, $300 in year 3, and so on. The…
A: #include <iostream>using namespace std; int main(){ double balance = 0; int year = 0;…
Q: Write a program that accepts dates written in numerical form and outputs in complete form. Enter…
A: here in question In this c code, there are 3 variables m, d, and y for storing month, day, and year.…
Q: Write two scnr.nextInt statements to get input values into birthMonth and birthYear. Then write a…
A: According to the Question below the Solution: Output:
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.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- 17. Redo Programming Exercise 16 so that the user can also input the cost of producing one liter of milk and the profit on each carton of milk.4.18 LAB: Exact change Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. Ex: If the input is: 0 (or less than 0), the output is: No change Ex: If the input is: 45 the output is: 1 Quarter 2 Dimes Python for this please.Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('%0.2f' % your_value) Ex: If the input is: 20.0 3.1599 the output is: 1.58 7.90 63.20 Your program must define and call the following driving_cost() function. Given input parameters driven_miles, miles_per_gallon, and dollars_per_gallon, the function returns the dollar cost to drive those miles. Ex: If the function is called with: 50 20.0 3.1599 the function returns: 7.89975 def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon) Your program should call the function three times to determine the gas cost for 10 miles, 50 miles, and 400 miles. Note: This is a lab from a previous chapter that now requires the use of a function.
- Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('{:.2f}'.format(your_value)) Ex: If the input is: 20.0 3.1599 the output is: 1.58 7.90 63.20 Your program must define and call the following driving_cost() function. Given input parameters driven_miles, miles_per_gallon, and dollars_per_gallon, the function returns the dollar cost to drive those miles. Ex: If the function is called with: 50 20.0 3.1599 the function returns: 7.89975 def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon) Your program should call the function three times to determine the gas cost for 10 miles, 50 miles, and 400 miles. Note: This is a lab from a previous chapter that now requires the use of a function. def driving_cost(driven_miles, miles_per_gallon,…Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('{:.2f}'.format(your_value)) Ex: If the input is: 20.0 3.1599 the output is: 1.58 7.90 63.20 Your program must define and call the following driving_cost() function. Given input parameters driven_miles, miles_per_gallon, and dollars_per_gallon, the function returns the dollar cost to drive those miles. Ex: If the function is called with: 50 20.0 3.1599 the function returns: 7.89975 def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon) Your program should call the function three times to determine the gas cost for 10 miles, 50 miles, and 400 miles. python # Define your function here. if __name__ == '__main__': # Type your code here.Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('{:.2f}'.format(your_value)) Ex: If the input is: 20.0 3.1599 the output is: 1.58 7.90 63.20 Your program must define and call the following driving_cost() function. Given input parameters driven_miles, miles_per_gallon, and dollars_per_gallon, the function returns the dollar cost to drive those miles. Ex: If the function is called with: 50 20.0 3.1599 the function returns: 7.89975 def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon) Your program should call the function three times to determine the gas cost for 10 miles, 50 miles, and 400 miles. python use this in answer please # Define your function here. if __name__ == '__main__': # Type your code here.
- Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('{:.2f}'.format(your_value)) Ex: If the input is: 20.0 3.1599 the output is: 1.58 7.90 63.20 Your program must define and call the following driving_cost() function. Given input parameters driven_miles, miles_per_gallon, and dollars_per_gallon, the function returns the dollar cost to drive those miles. Ex: If the function is called with: 50 20.0 3.1599 the function returns: 7.89975 def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon) # Define your function here. if __name__ == '__main__': # Type your code here.5.23 LAB: Exact change - functions Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is: 0 or less, the output is: no change Ex: If the input is: 45 the output is: 1 quarter 2 dimes Your program must define and call the following function. The function exact_change() should return num_dollars, num_quarters, num_dimes, num_nickels, and num_pennies.def exact_change(user_total) Note: This is a lab from a previous chapter that now requires the use of a function.Create a program that outputs "Changing return type, fingers crossed!". Then change the return type for the main function from 'int' to 'char' and instead of "return 0;" type "return 'a'". NOTE the 'a' is surrounded by single quotes.
- Question R .Consider the program segment below : #include <stdio.h> void guess (int,int); int main() { int a = 100, b = 200; int c; printf (“a is %d, b is %d\n”, a, b); guess (a, b); printf (“a is %d, b is %d\n”, a, b); return 0; } void guess (int x, int y) { int value; value = x; x = y; y = value; printf (“x is %d, y is %d\n”, x, y); } A. Identify the function call, the function header and the function prototype. B. What is the data type of x? C. Determine the output. Full explain this question and text typing work only We should answer our question within 2 hours takes more time then we will reduce Rating Dont ignore this line4.20 LAB: Warm up: Automobile service cost (1) Prompt the user for an automobile service. Output the user's input. (1 pt)Ex: Enter desired auto service: Oil change You entered: Oil change (2) Output the price of the requested service. (4 pts)Ex: Enter desired auto service: Oil change You entered: Oil change Cost of oil change: $35 The program should support the following services (all integers): Oil change -- $35 Tire rotation -- $19 Car wash -- $7 If the user enters a service that is not listed above, then output the following error message: Error: Requested service is not recognized 344614.2153518.qx3zqy7 Use Python for this please.5.19 In Python Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('{:.2f}'.format(your_value)) Ex: If the input is: 20.0 3.1599 the output is: 1.58 7.90 63.20 Your program must define and call the following driving_cost() function. Given input parameters driven_miles, miles_per_gallon, and dollars_per_gallon, the function returns the dollar cost to drive those miles. Ex: If the function is called with: 50 20.0 3.1599 the function returns: 7.89975 def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon) Your program should call the function three times to determine the gas cost for 10 miles, 50 miles, and 400 miles.