Write a C program using control statements if-else to read the score of a student from 0 to 100 and print the result accordingly. Score>80: Passed and promoted. 40
Q: write a program in C++ to input pricesalong with quantityof above items as inputand provide 10%…
A: The resultant C++ program code is given below: #include<iostream>#include<iomanip>using…
Q: Write an interactive program that contains an if statement that may be used to compute the area of a…
A: #include <stdio.h>#include <stdlib.h> int main() { char c; double dim, area;…
Q: Develop a program for current electrical billing system based on the given requirements using the…
A: 1. Flowchart for generating electricity bill
Q: Use switch-case statements for this program. Write a menu-driven c program which has the following…
A: Switch Statement is a multiple is a multiple choice selection statement. It will be executed…
Q: Write a program in C++ using if statement that assigns 100 to x when y is equal to 0.
A: Here, we are going to write a C++ program using if statement that assigns 100 to x when y is equal…
Q: WRITE A C PROGRAM: A particular type of packing carton costs P2.50 per square foot at the bottom and…
A: The program is written in C. Please find the program in below step.
Q: En
A: Code : #include <iostream>#include <string>#include <conio.h>using namespace…
Q: Write a C/C++ program that asks the user for three integer marks. These are the student marks out of…
A: Program Plan: 1. Include all the necessary header files. 2. Declare all the variables required. 3.…
Q: Ram, Mohan and Sohan took loan of Rs. x, y and z on rate of interest r%, p%, q% for time t1, t2 and…
A: C program is given below for calculate the simple interest using ternary operator and output the…
Q: Write a C/C++ program that asks the user for three integer marks. These are the student marks out of…
A: The required C++ code is given below: #include<iostream>#include<iomanip>using namespace…
Q: Write a C# program to read student name, id and score and then calculate grade based on score. If:…
A: Code: using System; namespace MyApplication{ class Program { static void Main(string[] args)…
Q: onstruct a C program using conditional statement base on the word problem presented below: A senior…
A: Condition operator is a ternary operator ie it operates on three operands and produces output.…
Q: use short-circuit evaluation to determine whether the following two compound conditions are TRUE or…
A: Formula used: a == b, if both a and b are equal, then “Yes” otherwise “No” a != b, if a and b are…
Q: Exercise 3: Write a C++ program that receive input for two variables (X,Y) and check whether they…
A: You have to give the values for X and Y in the OUTPUT screen/console. #include <iostream>using…
Q: Leap years occur in years exactly divisible by four, except that years ending in 00 are leap years…
A: Program in C: #include <stdio.h>int main() { int year; printf("Enter a year: ");…
Q: Write a program in C language for traffic controlling with given condition,…
A: Use two if condition simply and put the condition.
Q: in C Write a program that takes a word less than 25 characters long and prints a statement like…
A: #include<stdio.h> int main() { char str[25]; while(1) { printf("Enter word…
Q: Write a menu driven c++ program to display options for user whether he wants to check the entered…
A: Programming approach In the main function Display the menu. Input choice. Input number. Switch with…
Q: Write a menu driven c++ program to take input from user to find average of five subjects marks or…
A: Program: #include<iostream> using namespace std; int main() { int mark[5], i;…
Q: Write a C/C++ program that asks the user for three integer marks. These are the student marks out of…
A: To accept the student marks, we use mark[i]. In first for loop it will take 3 student marks. In…
Q: Write a C++ program to compute the volume of a cone using dynamic initialization feature. The volume…
A: Dynamic initialization feature is the ability to set or pass the values to the object of the class…
Q: rite a C program that shows the function of an atm machine. First ask user to select language, enter…
A: the code is given below : //header file #include <stdio.h> #include <conio.h> #include…
Q: Write a C/C++ program that asks the user for three integer marks. These are the student marks out of…
A: The marks are calculated as 50% weightage from normal tests and 50% weightage from big test
Q: Write a program that uses an if-elif-else statement to determine a traveling schedule. 1) request…
A: 'date'print ("Enter the your_date between(1-31).")date = int(input())if (date<1): print…
Q: XYZ Telegram Company charges P18.50 for a telegram that do not exceed 12 words and P1.50 for every…
A: C program: #include <stdio.h> int main() { char c; int words; scanf("%c",&c);…
Q: A person X wants to distribute the property share to his children and the wife. Write a C+ program…
A: We need to take input from a user of the below things - total property worth in PKR number of sons…
Q: Write the C++ program so that it processes both uppercase and lowercase letters and outputs the…
A: Telephonic digit of letter A or B or C or a or b or c is 2 D or E or F or d or e or f is 3 G or H or…
Q: Q1. Write a program in G+ language to obtain the equation below, for values of x from (1~ 20), by…
A: Note: The set of possible input values for cos inverse function are [1,1]. But in the question, it…
Q: Write a c++ program to display a calendar for a given year. Type of Branches such as switch…
A: A required C++ program is as follows, #include<iostream> #include<iomanip> using…
Q: Write a C program to take input the BMI of the user and print the grade of the user in the output.…
A: logic:- read bmi if(bmi<18.5)display "Underweight";else if(bmi>=18.5 &&…
Q: years occur in years exactly divisible by four, except that years ending in 00 are leap years only…
A: #include <iostream>#include <cmath>using namespace std;int main() { int year; cout…
Q: r business and write a C++ program that will showcase your knowledge in using if statement and…
A: Q. Choose a store, company or business and write a C++ program that will showcase your knowledge…
Q: Write a C program using control statements to read the score of a student from 0 to 100 and print…
A: Write a C program using control statements to read the score of a student from 0 to 100 and print…
Q: Question 1 Write a C++ program that inputs the price of a shoe in a shop, then deducts the discount…
A: The complete answer in C++ programming language is below:
Q: The students are required to develop a program using “if-statement” in the first program and switch…
A: Code: #include <iostream># include <string># include <cstdio>using namespace…
Q: Construct a C program using conditional statement base on the word problem presented below: Every…
A: Code: #include<stdio.h> int main(){ int year; printf("Enter Year:");…
Q: rite a C++ program using if-else or switch statements for calculating electricity bill, The range of…
A: We need to use the following data to compute the bill: 1) 1 to 100 units then the per-unit price is…
Q: Q1: Write a C# program that finds the value of Y from the following series: x5 x7 x2n+1 Y= x³ + + 2!…
A: The correct answer for the above mentioned question is given in the following steps for your…
Q: Convert the following C++ code from if-Statement to switch-statement, such that it gives the same…
A: Define header file <iostream> for io operations. Define main function. Define int variable x.…
Q: Write a C program to measure perimeter and area of circle and rectangle using switch case…
A: Algorithm: 1. Read the shape type as shape. 2. IF shape is 'C' Then: 2.1. Read the radius of the…
Q: Write a C++ program that assign a value to double variable cost depending on the value of integer…
A: Code #include<iostream>#include <stdio.h>using namespace std; int main(){ double…
Q: A person X wants to distribute the property share to his children and the wife. Write a C++ program…
A: #include <iostream>using namespace std; int main() { float…
Q: Write a C++ program to do the following: 1) read three marks . 2) compute the average. 3) find the…
A: Purpose of the program: This program asks three marks of a student, computes the average, and obtain…
Q: 3. Write a C program to accept a discount percentage on mobile prices between 0 to 100 from the user…
A: Introduction: In this question, we are asked to write a C program to calculate the average discount…
Q: Write a C program that asks a student to enter his/her scores in Test 1, Test 2, and Test 3, and…
A: C program to prompt the user to enter his/her scores. Assuming that the maximum score is 100. Store…
Q: Use DEV-C++ to develop a well-documented C++ program that: 1) Prompts the user to enter from the…
A: Code: #include <iostream>using namespace std;int main() { int n; //Iterating through the…
Q: Construct a c program language using conditional statement base on the word problem presented below:…
A: Introduction of C Program: The C program takes the number of consumed kilowatt-hours as an input…
Q: Write a C++ program that assign a value to double variable cost depending on the value of integer…
A: #include <iostream>using namespace std;int main(){ //For user input integer distance int…
Q: Write a C ++ program that demonstrates the use of the (CASE) switch. The program takes the…
A: Declare all the required headers in the answer program. Declare the main function. Declare variables…
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.
66. Write a C
Score>80: Passed and promoted.
40<Score<=80: Passed.
Score<=40: Fail and demoted.
Step by step
Solved in 3 steps with 3 images
- C++ Programming Exercise: A real estate office handles, say, 50 apartment units. When the rent is, say, $600 per month, all the units are occupied. However, for each, say, $40 increase in rent, one unit becomes vacant. Moreover, each occupied unit requires an average of $27 per month for maintenance. How many units should be rented to maximize the profit? Write a program that prompts the user to enter: a. The total number of of units. b. The rent to occupy all the units. c. The increase in rent that results in a vacant unit. d. Amount to maintain a rented unit. The program then outputs the number of units to be rented to maximize the profit.Question 1 Write a c program that allows to calculate z = |x-yl with x, y, z declared as integer and x and y initialized with values of your choice. Use for that a conditional structure: if .....; else ........; Type your answer Question 2 -- / 0 Type your answer -- / 0 Write a c program that allows to calculate z = |x-y| with x, y, z declared as integer and x and y initialized with values of your choice. Use for that a conditional structure: z = (condition)?(result1):(result2);c++ programming if…else and switch case are types of conditional selection statements used in many programming languages such as C++. Write your own codes for question (a), (b) and (c) to demonstrate how the selection statement works. (a) Using if….else selection statement, allow user to key in a number then check whether the number is positive or negative number. (b) Using if….else...if selection statement, allow user to key in a mark for one subject and display the grade for the subject. A for >80, B for >60, C for >50, D for >40, F for <40 .. (c) Using nested if..else selection statement, ask user to key in their age. Then define whether the user should go to nursery, primary school, secondary school or university based on their input. (d) Using switch case selection statement, allow user to key in a mark for one subject and display the grade for the subject. A for >80, B for >60, C for >50, D for >40, F for <40 .
- C++ program that will allow the user to input the First Name, Last name, Middle Initial, and grade of a student. following conditions must be observed: If the grade input is 96-100, the remark is “ excellent job! ” If the grade input is 91-95, the remark is “ yvery satisfactory job! ” If the grade input is 86-90, the remark is “satisfactory performance, ” If the grade input is 80-85, the remark is “ your performance is fair, ” If the grade input is 75-79, the remark is “ your performance needs Improvement, you can do it” If the grade input is below 75, the remark is “ we’re sorry but you failed," - You may only use the basic and usual codes no advance code- All lines of codes should have a comment. TEST CASES: Input first name: Johny Input last name: Raven Input middle Initial: T Input grade: 96 Result: John T Raven , excellent job! Input first name: ParkInput last name: ShinInput middle Initial: AInput grade: 49 Result: Park A. Shin,…Using c++ write a program : Write a program in C++ to handle the following scenario: Three friends Asif, Shahid and Bashir start the business. Input following from user. Enter amount invested by Asif (user will enter any value) Bashir’s contribution is equal to 250% of Asif’s contribution and Shahid’s contribution is equal to 75% of Bashir’s contribution. Display amount contributed by Bashir and Shahid. After 6 months business earned profit of 50% of total investment. Display the total profit and the amount each sharer will get (i.e. distribute profit as per percentage of their investment).Using c++ Write a program that computes and displays the charges for a patient’s hospital stay. First, the program should ask if the patient was admitted as an inpatient or an outpatient. If the patient was an inpatient, the following data should be entered: The number of days spent in the hospital The daily rate Charges for hospital services (lab tests, etc.) Hospital medication charges If the patient was an outpatient, the following data should be entered: Charges for hospital services (lab tests, etc.) Hospital medication charges Use a single, separate function to validate that no input is less than zero. If it is, it should be reentered before being returned. Once the required data has been input and validated, the program should use two overloaded functions to calculate the total charges. One of the functions should accept arguments for the inpatient data, while the other function accepts arguments for outpatient data. Both functions should return the total charges
- Test Content Question 1 Write a C++ program that inputs the price of a shoe in a shop, then deducts the discount from the price of the shoe as follows: 20% discount if the price of the shoe is above or equal 40 BD. 10% discount if the price of the shoe is more than or equal 15 BD and less than 40 BD. 5% discount if the price of the shoe is more than or equal 7 BD and less than 15 BD. 0% discount if the price of the shoe is below 7 BD. Then, your program should output: The initial shoe price, the discount amount and the final shoe price after discount. All numbers should be displayed with 2 decimal places. Use the editor to format your answerPROBLEM: Write a C++ program that will allow the user to input the First Name, Last name, Middle Initial, and grade of a student. The following conditions must be observed: If the grade input is 96-100, the remark is " you performed an excellent job! Keep it up !" If the grade input is 91-95, the remark is " you performed a very satisfactory Job! Keep it up !" If the grade input is 86-90, the remark is " you have satisfactory performance, you can improve some more. " If the grade input is 80-85, the remark is " your performance is fair, try harder" If the grade input is 75-79, the remark is " your performance needs Improvement, you can do it" If the grade input is below 75, the remark is " we're sorry but you failed, we know you can do better next time" а. b. c. d. е. f. SPECIFICATIONS that you need to follow: - You may only use the codes that we studied under our lectures. - All lines of codes should have a comment. - Save and Submit your cpp file as Surname - PE (Example: Pangaliman…Tasks: Design the C++ programing An ATM allows a customer to withdraw a maximum of $500 per day. If a customer withdraws more than $300, the service charge is 4% of the amount over $300. If the customer does not have sufficient money in the account, the ATM informs the customer about the insufficient fund and gives the option to withdraw the money for a service charge of $25.00. If there is no money in the account or if the account balance is negative, the ATM does not allow the customer to withdraw any money. If the amount to be withdrawn is greater than $500, the ATM informs the customer about the maximum amount that can be withdrawn. Design pseudo code and flowchart that allows the customer to enter the amount to be withdrawn. It then checks the total amount in the account, dispenses the money to the customer, and debits the account by the amount withdrawn and the service charges, if any
- Test Content Question 1 15 Points Write a C++ program that inputs the price of a shoe in a shop, then deducts the discount from the price of the shoe as follows: 20% discount if the price of the shoe is above or equal 40 BD. 10% discount if the price of the shoe is more than or equal 15 BD and less than 40 BD. 5% discount if the price of the shoe is more than or equal 7 BD and less than 15 BD. 0% discount if the price of the shoe is below 7 BD. Then, your program should output: The initial shoe price, the discount amount and the final shoe price after discount. All numbers should be displayed with 2 decimal places. Use the editor to format your answerUse C++ Programing language. Write a program that computes and displays the charges for a patient’s hospital stay. First, the program should ask if the patient was admitted as an inpatient or an outpatient. If the patient was an inpatient, the following data should be entered: The number of days spent in the hospital The daily rate Charges for hospital services (lab tests, etc.) Hospital medication charges If the patient was an outpatient, the following data should be entered: Charges for hospital services (lab tests, etc.) Hospital medication charges Use a single, separate function to validate that no input is less than zero. If it is, it should be reentered before being returned. Once the required data has been input and validated, the program should use two overloaded functions to calculate the total charges. One of the functions should accept arguments for the inpatient data, while the other function accepts arguments for outpatient data. Both functions should return the…Needs to be done in C# language. Problem Write a program that computes and displays the charges for a patient’s hospital stay. First, the program should ask if the patient was admitted as an in-patient or an out-patient. If the patient was an in-patient, the following data should be entered: • The number of days spent in the hospital• The daily rate• Hospital medication charges• Charges for hospital services (lab tests, etc.) The program should ask for the following data if the patient was an out-patient: • Charges for hospital services (lab tests, etc.)• Hospital medication charges The program should use two overloaded functions to calculate the total charges. One of the functions should accept arguments for the in-patient data, while the other function accepts arguments for out-patient information. Both functions should return the total charges. Input Validation: Do not accept negative numbers for any data.