Concept explainers
Write an if-else statement that outputs the word "Passed" provided the value of the variable exam is greater than or equal to 60 and also the value of the variable programsDone is greater than or equal to 10. Otherwise, the if-else statement should output the word "Failed". The variables exam and programsDone are both of type int.
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Absolute Java (6th Edition)
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Introduction To Programming Using Visual Basic (11th Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Modern Database Management
Starting Out with C++ from Control Structures to Objects (9th Edition)
- Please answer in matlab code.arrow_forwardBuilt in C++ using just if conditional: A fashion store is on promotion with all its clothes. If I buy three items I get a 50% discount on the two cheapest items. It is required to make a program that allows the user to enter the price of three items to be purchased and must show the value that must be paid for each item, the total to be paid and the total value of the discount. The program must validate that the prices entered are valid. Examples Original price 1: $125 2: $98 3: $132 Price to Pay: 1: $62.5 2: $49 3: $132 Total: $243.5 Discount: $111.5 Original price 1:$42 2: $89 3: $64 Price to Pay: 1:$21 2: $89 3: $32 Total: $142 Discount: $53 Original price 1: $111.8 2: $104.2 3: $78.6 Price to Pay: 1: $111.8 2: $52.1 3: $39.3 Total: $203.2 Discount: $91.4arrow_forwardQuestion 1 Write a program which takes the input from the user of time and distance and calculate the speed Where speed = distance / time If speed is between 40 -80, Print the message "You are Safe Driver" If speed is between 81 – 100, Print the message "Drive Carefully" If speed is more than 101, Print the message "Risky Driving" Otherwise print "Try again".arrow_forward
- An argument is expressed in English below. Sara is not excited. If Sara is not excited, then Sara will go to the party. Sara is sleepy. 4 : Sara will go to the party and Sara is sleepy. Variable names are assigned to each English phrase as follows: • q: Sara is excited •r: Sara will go to the party • : Sara is sleepy What is the form of the argument? Pick Pick v .: Pick 2 Check Nextarrow_forwardWrite 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.arrow_forwardPlease answer item number 3. (pyhthon programming)arrow_forward
- PYTHON PROGRAMMINGarrow_forwardCode in Pythonarrow_forwardComplete the following program When a machine reads blood pressure from a human body it displays two numbers they are called Systolicand Diastolic pressures. The program will take systolic and diastolic reading as input from the user and displays a message whether the person's blood pressure is "Normal" or "Elevated" or "High Blood Pressure". Program consists of two functions as follows. void input( .): This function is with two pass by reference parameters, and it reads input from the user. string process..): It receives two numbers(systolic and diastolic) and then it determines and returns a category according to the table below. Systolic |80 to 120 | 120 to 139 High blood equal and above 140 Diastolic Category Normal and 60 to 80 Elevated and 80 to 90 pressure above 90 or main () program is given below and you are asked to write the function definitions in the space provided below. #include #include using namespace std; void input(int &, int &); string process(int, int); int main()…arrow_forward
- 3.Professor Mysterious uses a special formula to calculate the grade of his students. Write a program that repeatedly does the following: a. Prompt the user to enter the grade of the first test b. Prompt the user to enter the grade of the second test . Prompt the user to enter the grade of the third test. The program should then calculate and displays the student grade based on the following formula: grade-.25*testi+.61 test2+.14 test3 NOTE: Exit the program using sentinel or magic value. SAMPLE PROGRAM RUN Enter Test1 (0 to exit): 100 Enter Test2:90 Enter Test3:87 Grade: 92.08 Enter Test1 (0 to exit): 0 Thank you for using this program.arrow_forwardThis assignment is to write a program to score the rock-paper-scissors game. Each of two playersenters R, P, or S. The program than announces the winner as well as the basis for determiningthe winner: "Paper covers rock", "Rock breaks scissors", "Scissors cut paper", or "Draw, nobodywins". Use nested if statements (or if-else-if) to do the homework.In this assignment, you will write two functions, getThrow and checkWinner. Your getThrowfunction will be given an int representing a player number to prompt and will ask that player toenter one of rock, paper, or scissors, repeating until they enter a valid input and returning a charrepresenting the result. Your checkWinner function will be given two chars representing the throwsof the two players and will print the results of the contest. Both functions must accept both upperand lowercase inputs.Your main function will call both functions to form a complete program. Remember that youcan call a function multiple times. Your program will be…arrow_forwardBody Mass Index (BMI) is a measure of health on weight. It can be calculated by taking your weight in kilograms and dividing by the square of your height in meters. Write a program which prompts the user to enter the weight in kgs (integer value) and height in feet and inches (both integers) and then calculates the BMI of the person. Your program first need to convert inches to meters (i.e. inches * 0.0254) and then use the following formula to calculate BMI: weight kilogram / (height_meter)^2 Your program displays the BMI value in two decimal places and the corresponding status as shown in the examples below. Note that one inch is 0.0254 meters and 1 foot is 12 inches. For example: Input Result 62 5 10 89 6 0 45 BMI BMI < 18.5 18.5 s BMI < 25.0 25.0 ≤ BMI < 30.0 30.0 ≤ BMI 7 82 5 Interpretation Underweight Normal Overweight Obese 2 Enter weight (kg): Enter height (feet): Enter height (inches): BMI is 19.61, Normal Enter weight (kg): Enter height (feet): Enter height (inches): BMI is…arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,