Write 2 different programs using if statement and switch statement that presents the iser w/ a choice of 5 beverages (Coke, Water, Sprite, ... , and so on). Then allow the user to choose a beverage by entering a number 1-5. Dutput which beverage they chose. Sample Output: *Beverages**** 1- COKE 50 2- WATER 20 B- SPRITE 60 - ROYAL 50 5- MT.DEW Choose a beverage : tem name: ? tem price:? Amount: ? Amt. paid: 60 (assume that the amt paid is equal or higher than amount) - Change:
Q: Write a program which prompts the user for their age. If they are 19 or younger inform them that…
A: "Since you have not mention any programming language, so we will write this program in C++…
Q: Write a program that inputs a number and a letter and then decides whether the square is a black or…
A: Required: Write a program that inputs a number and a letter and then decides whether the square is a…
Q: TASK 3: Write a program that accepts the input code from the user and print according to the input…
A: in c: #include <stdio.h>int main(){ int n1; printf("enter the number: ");…
Q: Car experts recommend changing your air filter as often as every 6000 miles if the oil’s category is…
A: Given:
Q: Write a temperature-conversion program that gives the user the option of converting Fahrenheit to…
A: The program is written in python def CtoF(): celsius = float(input("Enter temperature in…
Q: 5. Write a program that reports whether someone is eligible to run for president in the U.S. You…
A: According to the information given:- We have to follow instruction to create eligibility criteria
Q: 5. The user will input a Philippine amount, then the said amount will be converted to different…
A: Get Phillipine peso input from user. Calculate currency amount's equivalence using the formula (1…
Q: Write an if-else statement with multiple branches. If year is 2101 or later, print "Distant future"…
A: CODE:- year = int(input())if year >= 2101: print('Distant future')elif year >= 2001:…
Q: Q1) Write a program in which take a year from user and check whether it is leap year or not using…
A: A normal year contains 365 days where a leap year contains 366 with February contains 29 days. A…
Q: Write aC++program that allows a user to enter their rating of the three movies in the DarkKnight…
A: [Note: Explanation of the program code is provided within the comments.] Program code:…
Q: 1. Write a program that prompts the user to enter an integer between 0 and 6 and prints thie day…
A: I give both codes in C along with output and code screenshots.
Q: In [ ]: # write a program to accept a number from the user, # print "Play basketballL" if the number…
A: PROGRAM CODE: n = int(input("Enter the number: ")) // take number from the userif n<=15:…
Q: The general form of (Compound if) is: If (condition); {statmenet1; } else {statmenet1; } * true…
A: A variable holds garbage value when not initialised. C plus plus is case sensitive programming…
Q: If you know the balance and the annualpercentage interest rate, you can compute the interest on the…
A: Program code: //import the required packages import java.util.Scanner; //define class…
Q: 1. Write a program that does the following: Ask the user to enter the price of their items. The user…
A: Actually, program is a executable software that runs on a computer.
Q: Question 1: Write a C program that do the following: A Ask the user to enter his grade as (A, B, C,…
A: Below is the required code in C language. Approach to Program: Include necessary header files to…
Q: Using Switch statement, write a program that displays the following menu for the food items…
A: The choice and quantity will be the input Based on input choice we implement a switch block to…
Q: Q3: Write a VB program to enter a mark of a student and then find his grade as follows: If mark >=75…
A: VB program is asked with the following conditions: If mark>=75 print Grade = A If…
Q: / Write a program (using IF statement) to display the name of day by giving the day number as the…
A: The required Matlab program has been provided, by using if-else statements, in the next step.
Q: Q3.Write a program that input the month and the day. If the month entered isn't between I and 12,…
A: Note: Since programming language is not mentioned. Therefore answering the question in python…
Q: Complete the if-else statement to print 'LOL means laughing out loud' if user_tweet contains 'LOL'.…
A: user_tweet = input() if 'LOL' in user_tweet : print('LOL means laughing out loud.')else :…
Q: A contractor orders, say, 30 cubic yards of premixed concrete to construct a patio that is to be,…
A: C++ Code for the given Question #include<bits/stdc++.h>#include <iostream> using…
Q: Write a program that asks the user to enter two integers, obtains thenumbers from the user, then…
A: C++ Program for above : #include <iostream> using namespace std; int main() { //read…
Q: Re-write the following program by converting IF-ELSE statement to SWITCH statement. #include Using…
A: A switch is a control expression that allows one to choose one option from a list of options. The…
Q: n employee’s total weekly pay equals the hourly wage multiplied by the total number of regular hours…
A: STEPS - Declare variables to calculate total weekly pay. Take input from user named with wages per…
Q: 5. The user will input a Philippine amount, then the said amount will be converted to different…
A: We need to write a C language program that reads input from the user for currency in Philippine peso…
Q: Write a program that prompts the user to enter the number of courses taken by a student. The program…
A: C++ used to answer this question
Q: Question 1: Write a C program that do the following: Ask the user to enter his grade as (A, B, C, D,…
A: Include an appropriate header in the C program such as stdio.h. stdio.h is a C header file that…
Q: Write 2 different programs using if statement and switch statement that will ask the user which…
A: #include<stdio.h>int main(){ double firstN, secondN; char ch; printf("Enter the…
Q: Q: Write a program that will show the following output of the string "Rroduct. Name: HP Laptop…
A: The given program is a simple case of displaying given output. Print statements can be used to…
Q: Write a program using else if to input the number of students(stu) and number of teachers(tea) in…
A: C used to answer this question
Q: Write an if-else statement with multiple branches. If year is 2101 or later, print "Distant future"…
A: year=int(input()) #taking the inputif(year>=2101): #condition for distant futureprint("Distant…
Q: Write a VB program to ask user to assign a value to “i” to find the answer for the following three…
A: Dim i As IntegerDim HowMuch As IntegerHowMuch = 0For i = 1 To 10 If i < 5 Then HowMuch…
Q: 5. Write a program that reports whether someone is eligible to run for president in the U.S. You…
A: According to the information given:- We have to create a program to satisfy the output.
Q: 1. A 10% discount is applied to purchases over $10.00. Write a program that asks for amount…
A: The program is created as follows: Declare variables for purchase amount, discount and discounted…
Q: Write multiple if statements. If car_year is 1969 or earlier, print "Few safety features." If 1970…
A: As No coding language is provided, giving the code in c++: #include <iostream>using namespace…
Q: Write a program that inputs three different integers from the keyboard, then prints the sum, the…
A: here is your code
Q: A student took four quizzes in a term and would like to compute their average
A: Program: # python version 3# main functiondef main(): print("Enter the quiz score out of 100")…
Q: Q2. Write a program that reports the contents of a compressed-gas cylinder based on the first letter…
A: C program
Q: Not allowed to use decisions or loops, if then statements, I haven't learned that. I have to use…
A: Since here no programming language is specified. So, we are providing the solution in Java. The…
Q: QI- Write a program to print (very short when the height is less than 150 or print (average if the…
A: lets first analyze bot codesa)if(a<150)%if a is less than 150disp("very short")%printing very…
Q: The first 11 prime integers are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, and 31. A positive integer…
A: This Program has been solved using the C language.
Q: Complete the if-else statement to print 'LOL means laughing out loud' if user_tweet contains 'LOL'…
A: I have given complete code in step2.
Q: 3. Re-write the following program by using switch statement. int main() { int code; cout>code; if (…
A: The given problem is related to C++ programming where the given code has used if-else statement…
Q: Write a program that, depending on the user's choice inputs int, double or string variable. If the…
A: Take the user input put them in switch case and print the output.
Q: Write a program that prompts the user to enter the name, the number of children, and the basic…
A: Please give positive ratings for my effort. Thanks. PROGRAM #include<bits/stdc++.h>using…
Q: o Write a program that asks for an integer and reports whether the number is odd or even. Use if ..…
A: The condition for even is Integer must be divisible by 2 The condition for odd is Integer must not…
Q: C# Write a program for The Carefree Resort named ResortPrices that prompts the user to enter the…
A: Algorithm: Start Read enter the number of days for a resort stay n If n==1 or n==2,calculate cost…
Q: A contractor orders, say, 30 cubic yards of premixed concrete to construct a patio that is to be,…
A: Given The answer is given below.
Using DEV C++
Trending now
This is a popular solution!
Step by step
Solved in 7 steps with 4 images
- Write a VB program to ask user to assign a value to “i” to find the answer for the following three cases. Case 1. Assume i = 1 and HowMuch = 0 IF i < 5 THEN HowMuch = HowMuch + 1 ELSEIF i = 5 THEN HowMuch = HowMuch - 5 ELSE HowMuch = HowMuch + 3 END IF DISPLAY HowMuch Case 2. Assume i = 5 and HowMuch = 0 IF i < 5 THEN HowMuch = HowMuch + 1 ELSEIF i = 5 THEN HowMuch = HowMuch - 5 ELSE HowMuch = HowMuch + 3 END IF DISPLAY HowMuch Case 3. Assume i = 6 and HowMuch = 0 IF i < 5 THEN HowMuch = HowMuch + 1 ELSEIF i = 5 THEN HowMuch = HowMuch - 5 ELSE HowMuch = HowMuch + 3 END IF DISPLAY HowMuchA. Rewrite the following program using switch statement:int main(){int testScore; // Holds a numeric test scorechar grade; // Holds a letter gradecout << "Enter your test score and I will tell you\n";cout << "the letter grade you earned: ";cin >> testScore;if (testScore = = 60)grade = 'F';if (testScore = = 70)grade = 'D';if (testScore = = 80)grade = 'C';if (testScore = = 90)grade = 'B';if (testScore = = 100)grade = 'A';cout << "Your grade is " << grade << ".\n";return 0;} B. Rewrite the following code, replacing the do-while loop with a while loop. When you do this you will no longer need an if statement. int number;cout << "Enter an even number: ";do{ cin >> number;if (number % 2 != 0)cout << "Number must be even. Reenter number: ";} while (number % 2 != 0); C. Given an array definition as follows, write the codes which will determine the highest value.const int SIZE = 10;int numbers[SIZE] = {15, 6, 3, 11, 22, 4, 0, 1, 9, 12}; D.…Write a C++ program that : You have to do the following question only by nested if-statement. FROM GRADE A TO F A 93-100% A- 90-92% B+ 87-89% B 83-86% B- 80-82% C+ 77-79% C 73-76% C- 70-72% D+ 67-69% D 63-66% D- 60-62% F Ask user to enter a grade and then determine the letter grade. Sample output: What is your grade: 85 Your grade on your trascript would be B
- Write a program that asks the user for a number in the range of 1 through 7. The programshould display the corresponding day of the week, where 1 = Monday, 2 = Tuesday, 3 =Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday, and 7 = Sunday. The program shoulddisplay an error message if the user enters a number that is outside the range of 1 through 7Write a VB program to ask user to assign a value to “i” to find the answer for the following three cases. 1. Case 1. Assume i = 1 and HowMuch = 0IF i < 5 THENHowMuch = HowMuch + 1ELSEIF i = 5 THENHowMuch = HowMuch - 5ELSEHowMuch = HowMuch + 3END IFDISPLAY HowMuch2. Case 2. Assume i = 5 and HowMuch = 0IF i < 5 THENHowMuch = HowMuch + 1ELSEIF i = 5 THENHowMuch = HowMuch - 5ELSEHowMuch = HowMuch + 3END IFDISPLAY HowMuch3. Case 3. Assume i = 6 and HowMuch = 0IF i < 5 THENHowMuch = HowMuch + 1ELSEIF i = 5 THENHowMuch = HowMuch - 5ELSEHowMuch = HowMuch + 3END IFDISPLAY HowMuchWrite aC++program that allows a user to enter their rating of the three movies in the DarkKnight Trilogy: Batman Begins/ The Dark Knight /The Dark Knight Rises Ratings must be between 1 and 5. If a rating entered is less than 1 or more than 5, display anappropriate message and do not use the rating. After all the ratings have been entered, display each rating entered, the highest rating, the lowest rating, and the average of the ratings.
- Write a program using if statement instead of switch statement. x=2; switch x case 1; disp(‘One’) case 2; disp(‘Two’) case 3; disp(‘Three’) otherwise; disp(‘Unknown Number’) endWrite a pseudo code in which you ask the user to will enter a number and then enter 5 more numbers using the while statement to do this and in the end your program will show how much number were divisor by the number you enter at start. Also the program should terminate if the users enters a negative value at any stage. Enter a Number: 2Enter 1 Number: 4Enter 2 Number: 5Enter 3 Number: 6Enter 4 Number: 7Enter 5 Number: 8Total divisor are: 3Write a program which prompts the user for their age. If they are 19 or younger inform them that qualify for student discounts. If they are between 20 and 65 inform them that they qualify for no age discounts. If they are 65 or over inform them that they can receive senior discounts.
- The cost of renting a room at a hotel is, say $100.00 per night. For special occasions, such as a wedding or conference, the hotel offers a special discount as follows: If the number of rooms booked at least 10, the discount is 10%; at least 20, the discount is 20%; and at least 30, the discount is 30%. Also if rooms are booked for at least three days, then there is an additional 5% discount. Write a program that prompts the user to enter the cost of renting one room, the number of rooms booked, the number of days the rooms are booked, and the sales tax (as a percent). The program outputs the cost of renting one room, the discount on each room as a percent, the number of rooms booked, the number of days the rooms are booked, the total cost of the rooms, the sales tax, and the total billing amount. Your program must use appropriate named constants to store special values such as various discounts.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.The statements in the following program are not in the correct order. Rearrange the statements so that the program outputs the total time an employee spent on the job each day. The program asks the user to enter the employee’s name, the arrival time (arrival hour, arrival minute, AM or PM), and departure time (departure hour, departure minute, AM or PM). The program also allows the user to run the program as long as the user wishes. After rearranging the statements, your program must be properly indented.