Concept explainers
Suppose savings and expenses are variables of type double that have been given values. Write an if-else statement that outputs the word Solvent, decreases the value of savings by the value of expenses, and sets the value of expenses to 0, provided that savings is at least as large as expenses. If, however, savings is less than expenses, the if-else statement simply outputs the word Bankrupt and does not change the value of any variables.
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Mechanics of Materials (10th Edition)
SURVEY OF OPERATING SYSTEMS
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Starting Out With Visual Basic (8th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
- In admissions to military high schools, the age of the candidate should be between 13 - 17 (including lower and upper limit) and body mass index should be in the range of 18.50 - 24.99 (including lower and upper limit). (Body mass index is calculated by dividing weight by the square of height in meters. BMI = weight / height2). Write the JAVa program on the screen that will show whether the candidate will be admitted to military high school according to age, weight and height information entered on the keyboard.arrow_forwardA student makes the following argument. if I receive a good grade, the instructor teaches well. I didn't receive a good grade. Therefore, the instructor didn't teach well. is the student's argument valid? Let A be the statement, "I receive a good grade" and B be the statement, " the instructor teaches well." Then, rewrite the above paragraph using A and B.arrow_forwardInterest on a credit card’s unpaid balance is calculated using the average daily balance. Suppose that netBalance is the balance shown in the bill, payment is the payment made, d1 is the number of days in the billing cycle, and d2 is the number of days payment is made before billing cycle. Then, the average daily balance is: averageDailyBalance = (netBalance * d1 - payment * d2) / d1. The interest on the unpaid balance is: interest = averageDailyBalance * interestRate where interestRate is the interest rate per month. Write a program that accepts as input netBalance, payment, d1, d2, and interestRate. The program outputs the interest. Format your output to two decimal places. Analyze and design this program. Write the code, compile and run it. Upload your analysis and design document and your .cpp source code file here.arrow_forward
- Problem: you are required to write a Java program that will prompt for and read 3 integer values vac1, vac2 and vac3representing the number of people who did not take any dose (vac1), the people who took the first and second dose (vac2)and those who took all the three doses (vac 3) of COVID-19 vaccine respectively.Using nested ifs determine the characteristics of this population vaccination, and display the message:• 50% vaccination hesitancy rate! If vac1 equals the sum of vac2 and vac3.• higher immunity rate! If vac1 smaller than the sum of vac2 and vac 3.• lower immunity rate! If vac1 is higher than the sum of vac2 and vac3.Also is if the number of people vaccinated with the three doses vac3 is higher or equal to 90% the total of people(vac1+vac2+vac3), display the message Wow herd immunity! Similarly, if the number of people not vaccinated (vac1)is higher or equals 90% of the total of people (vac1+vac2+vac3), display the message arm yourself against COVID19. Finish off by…arrow_forwardCorrect answer only. Code and output screenshot. Nastia has 2 positive integers An and B. She characterizes that: The integer is acceptable in case it is detachable by A⋅B; In any case, the integer is almost acceptable, in case it is detachable by A. For instance, if A=6 and B=4, the integers 24 and 72 are acceptable, the integers 6, 660 and 12 are almost acceptable, the integers 16, 7 are neither acceptable nor almost great. Discover 3 unique positive integers x, y, and z to such an extent that precisely one of them is acceptable and the other 2 are almost acceptable, and x+y=z. Input The main line contains a solitary integer t (1≤t≤10000) — the number of experiments. The primary line of each experiment contains two integers An and B (1≤A≤106, 1≤B≤106) — numbers that Nastia has. Output For each experiment print: "Indeed" and 3 distinct positive integers x, y, and z (1≤x,y,z≤1018) to such an extent that precisely one of them is acceptable and the other 2…arrow_forwardInterest on a credit card’s unpaid balance is calculated using the average daily balance. Suppose that netBalanceis the balance shown in the bill, paymentis the payment made, d1is the number of days in the billing cycle, and d2is the number of days payment is made before the billing cycle. Then the average daily balance is: averageDailyBalance = (netBalance * d1 –payment * d2) / d1 if the interest rate per month is say, 0.0152, then the interest on the unpaid balanceis: interest = averageDailyBalance * 0.0152 Design a program that accepts as input netBalance, payment, d1, d2, and interest rate per month. The program outputs the interest charged. Format your output to two decimal places. C++arrow_forward
- Integers numBananas and dollarAmount are read from input. A banana costs 2 dollars. If numBananas is less than 4, output "numBananas requires at least 4 to purchase." If numBananas is greater than or equal to 4, then declare and initialize int variable totalCost with the product of numBananas and 2. If totalCost is less than or equal to dollarAmount, output "Bananas successfully purchased." Otherwise, output "Not enough money to buy all." If numBananas is greater than 36, output "Restocking soon." End with a newline. Ex: If the input is 17 59, then the output is: Bananas successfully purchased. #include <iostream>using namespace std; int main() { int numBananas; int dollarAmount; cin >> numBananas; cin >> dollarAmount; /* Your code goes here */ return 0;}arrow_forwardQ1. Write a program in which the output of the program should be the performance result of a student till its last semester. The performance is calculated on the basis of CGPA obtained by student. The performance is Excellent if student CGPA is greater than 3.5 and less than equal to 4.0, good if student CGPA is greater than 3.0 and less than equal to 3.5, satisfactory if student CGPA is greater than 2.0 and less than equal to 3.5 and not satisfactory if less than equal to 2.0. The GPA is calculated on the basis of following points, user will enter the percentage of student subjects (at least 5) and your program should give the performance output of student. Your program should display the grade of each subject. Marks Grades Undergraduate points 90-100 A 4.00 86-89 A- 3.67 81-85 B+ 3.33 77-80 3.00 72-76 В- 2.67 68-71 С+ 2.33 63-67 C 2.00 58-62 С- 1.67 54-57 D+ 1.33 50-53 D 1.00 Below 50 F 0.00arrow_forwardwhat is If...Then...Else statement ?arrow_forward
- Do in jupyter notebook! I'm not confident of my code please help me out .arrow_forward7. Write a program that will check and print if the person is a regular passenger, student or senior citizen to determine the fare of the person in a passenger boat. If it is number 1 = Regular passenger, 2 = Student passenger and lastly 3 = Senior Citizen passenger.arrow_forwardAlert -Don't submit AI generated answer and i need unique response only if I see plagiarism then I'll reduce rating for sure.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning