Concept explainers
If
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Computer Science: A Structured Programming Approach Using C, Third Edition
- Write a multiple assignment statement that can be used instead of the followinggroup of assignment statements:east = 1;west = 1;north = 1;south = 1;arrow_forwardWrite a statement that assigns finalValue with the multiplication of userNum1 and userNum2. Ex: If userNum1 is 6 and userNum2 is 2, finalValue is 12. let userNum1 = 6; // Code tested with values: 6 and 4let userNum2 = 2; // Code tested with values: 2 and -2 let finalValue = 0;arrow_forwardNeeds 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.arrow_forward
- Problem: A company wants a program that will calculate the weekly paycheck for an employee based on how many hours they worked. For this company, an employee earns $20 an hour for the first 40 hours that they work. The employee earns overtime, $30 an hour, for each hour they work above 40 hours. Example: If an employee works 60 hours in a week, they would earn $20/hr for the first 40 hours. Then they would earn $30/hr for the 20 hours they worked overtime. Therefore, they earned: ($20/hr 40hrs) + ($30/hr 20 hrs) = $800 + $600 = $1400 total. For this assignment, you must create pseudocode and a flowchart to design a program that will calculate an employee's weekly paycheck. . Write pseudocode to design a programming solution by outlining a series of steps and using appropriate indentation and keywords. As you write your pseudocode, be sure to consider the following: What input does the computer need? What steps does the program need to follow to process the input? What output should…arrow_forwardJAVA CODE PLEASE Functions With No Parameters and Return Values Practice ll by CodeChum Admin Create a program that has a global integer variable assigned to a value of 1. Then, create a new function named increment that increments the global variable. In the main function, if the current value of the global variable is divisible by 3, print “Cody!”. Otherwise, print the value of that global variable. Repeatedly call the increment function until the value of the global variable is greater than 15. Output Multiple lines containing a string or an integer 1 2 Cody! 4 5 Cody! 7 8 Cody! 10 11 Cody! 13 14 Cody! Score:arrow_forwardWhat is the final value of y? int x = 4; 6; int y if (x < 10) { if (y < 5) { y = y + 1; } } else { } y = 7; } else { y = y + 10;arrow_forward
- Python Code Needed Problem: A company wants a program that will calculate the weekly paycheck for an employee based on how many hours they worked. For this company, an employee earns $20 an hour for the first 40 hours that they work. The employee earns overtime, $30 an hour, for each hour they work above 40 hours. Example: If an employee works 60 hours in a week, they would earn $20/hr for the first 40 hours. Then they would earn $30/hr for the 20 hours they worked overtime. Therefore, they earned: ($20/hr * 40hrs) + ($30/hr * 20 hrs) = $800 + $600 = $1400 total. For this assignment, you must create pseudocode and a flowchart to design a program that will calculate an employee’s weekly paycheck. Write pseudocode to design a programming solution by outlining a series of steps and using appropriate indentation and keywords. As you write your pseudocode, be sure to consider the following: What input does the computer need? What steps does the program need to follow to process the input?…arrow_forwardint p = 200;int q = 100;if(p%2==0){q = q/50;}else{q = q/100;}q = ? What will be the final value of q . In C++arrow_forwardI need help with this I must use modular programming and declare variables. Write an application that computes a business's potential profits each year for 20 years using the //following assumptions: // 1 - Expenses in the first year are expected to be $35,000 //2 - Gross profit in the first year is projected to be $20,000 //3 - Net profit or loss is gross profit minus expenses //4 - Gross profits are expected to increase 10% each year //5 - Expenses are expected to increase 4% each year //Display the year, the gross profit, the expenses, and the net profit for each year.arrow_forward
- A BOOKSTORE SELLS BOOKS UNDER THE FOLLOWING CONDITIONS: a. IF THE CLIENT IS TYPE 1, 30% IS DISCOUNTED b. IF THE CLIENT IS TYPE 2, 20% DISCOUNT c. IF THE CLIENT IS TYPE 3, 10% IS DISCOUNTED WHEN THE CUSTOMER MAKES A PURCHASE, THE FOLLOWING DATA ARE GENERATED: CUSTOMER NAME TYPE OF CLIENT (1,2,3) NUMBER OF BOOKS COST PER BOOK DEVELOP A PROGRAM IN C++ THAT READS THIS DATA AND PRINT: CUSTOMER NAME TОTAL TO PAY DISCOUNT NET TO PAY. NOTE: USE SWITCH STRUCTUREarrow_forwardA BOOKSTORE SELLS BOOKS UNDER THE FOLLOWING CONDITIONS: a. IF THE CLIENT IS TYPE 1, 30% IS DISCOUNTED b. IF THE CLIENT IS TYPE 2, 20% DISCOUNT c. IF THE CLIENT IS TYPE 3, 10% IS DISCOUNTED WHEN THE CUSTOMER MAKES A PURCHASE, THE FOLLOWING DATA ARE GENERATED: CUSTOMER NAME TYPE OF CLIENT (1,2,3) NUMBER OF BOOKS COST PER BOOK DEVELOP A PROGRAM IN C++ THAT READS THIS DATA AND PRINT: CUSTOMER NAME TОTAL TO PAY DISCOUNT NET TO PAY. NOTE: USE SWITCH STRUCTURE Write a function that returns the smallest of three floating-point numbers.arrow_forwardQuastion2: Write program in e++ language that compute the following equation: Y= 100 <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