Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
5th Edition
ISBN: 9780134801155
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 3, Problem 2PE
Program Plan Intro
Sales Tax
Program Plan:
- Declare a function named “calc()”. This function accepts a parameter named “amt”. Inside the function,
- Assign state sales tax value to the variable “s_salestax”.
- Assign county sales tax value to the variable “c_salestax”.
- Calculate state sales tax and store it in a variable “sstax”.
- Calculate county sales tax and store it in a variable “cstax”.
- Calculate total tax and store it in a variable “totaltax”.
- Calculate total sale and store it in a variable “totalSale”.
- Print the values.
- Inside the “main ()” function,
- Get the amount from the user and store it in a variable “amount”.
- Call the function “calc()” by passing “amount” as the argument.
- Call the main function.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Hospital Management Project "Simple Scenario We want to develop a comprehensive software product for XY Hospital, where several doctors are working together. There are several departments in the hospital, but a central administrationoffice is handling the patient appointment tasks. Most patients make an appointment before their visit. However, patients can walk in and can be treated if an appropriate doctor is available. On events, patients may change their visit schedule by calling. A patient who made an appointment but cannot appear should cancel his/her appointment in order to avoid a "no-show penalty. The appointment clerks i the administration office are handling all the appointments and the scheduling clerks generate "daily treatment schedules for doctors based on the appointment. The "daily treatment schedules' include doctor's name, patient's information, nurses and treatment rooms for each treatment. Hence, doctors are seeing patients according to the daily treatment schedule.…
Tracking laps
Learning Objectives
In this lab, you will practice
writing functions, passing arguments and returning results from the function
printing the result of a function call
writing your code as a module
Instructions
Main Idea
An Olympic-size swimming pool is used in the Olympic Games, where the racecourse is 50 meters (164.0 ft) in length. "In swimming, a lap is the same as a length. By definition, a lap means a complete trip around a race track, in swimming, the pool is the race track. Therefore if you swim from one end to the other, you’ve completed the track and thus you’ve completed one lap or one length." (Source: What Is A Lap In Swimming? Lap Vs Length)
Write the function meters_to_laps() that takes a number of meters as an argument and returns the real number of laps. Complete the program to output the number of laps with two digits after the period.
Examples
Input:
150
Output :
3.00
Input:
80
Output:
1.60
Your program must define and call the following…
Give me answer
Chapter 3 Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Ch. 3.1 - What is a module?Ch. 3.1 - Prob. 3.2CPCh. 3.1 - Prob. 3.3CPCh. 3.1 - Prob. 3.4CPCh. 3.1 - Prob. 3.5CPCh. 3.2 - In most languages, a module definition has what...Ch. 3.2 - Prob. 3.7CPCh. 3.2 - Prob. 3.8CPCh. 3.2 - Prob. 3.9CPCh. 3.3 - What is a local variable? How is access to a local...
Ch. 3.3 - What is a variables scope?Ch. 3.3 - Prob. 3.12CPCh. 3.3 - Prob. 3.13CPCh. 3.4 - Prob. 3.14CPCh. 3.4 - What are the variables that receive pieces of data...Ch. 3.4 - Prob. 3.16CPCh. 3.4 - Prob. 3.17CPCh. 3.4 - Prob. 3.18CPCh. 3.5 - What is the scope of a global variable?Ch. 3.5 - Give one good reason that you should not use...Ch. 3.5 - Prob. 3.21CPCh. 3 - A group of statements that exist within a program...Ch. 3 - Prob. 2MCCh. 3 - The first line of a module definition is known as...Ch. 3 - Prob. 4MCCh. 3 - Prob. 5MCCh. 3 - A design technique that programmers use to break...Ch. 3 - Prob. 7MCCh. 3 - A _____ is a variable that is declared inside a...Ch. 3 - A(n) ____ is the part of a program in which a...Ch. 3 - A(n) ____ is a piece of data that is sent into a...Ch. 3 - A(n) ____ is a special variable that receives a...Ch. 3 - When _____, only a copy of the argument's value is...Ch. 3 - When ____, the module can modify the argument in...Ch. 3 - A variable that is visible to every module in the...Ch. 3 - When possible, you should avoid using _____...Ch. 3 - The phrase divide and conquer means that all of...Ch. 3 - Prob. 2TFCh. 3 - Module names should be as short as possible.Ch. 3 - Prob. 4TFCh. 3 - A flowchart shows the hierarchical relationships...Ch. 3 - Prob. 6TFCh. 3 - A statement in one module can access a local...Ch. 3 - In most programming languages, you cannot have two...Ch. 3 - Programming languages typically require that...Ch. 3 - Most languages do not allow you to write modules...Ch. 3 - When an argument is passed by reference, the...Ch. 3 - Prob. 12TFCh. 3 - Prob. 1SACh. 3 - Prob. 2SACh. 3 - Prob. 3SACh. 3 - What is a local variable? What statements are able...Ch. 3 - In most languages, where does a local variables...Ch. 3 - What is the difference between passing an argument...Ch. 3 - Prob. 7SACh. 3 - Design a module named timesTen. The module should...Ch. 3 - Examine the following pseudocode module header,...Ch. 3 - Look at the following pseudocode module header:...Ch. 3 - Assume that a pseudocode program contains the...Ch. 3 - Design a module named getNumber, which uses a...Ch. 3 - What will the following pseudocode program...Ch. 3 - What will the following pseudocode program...Ch. 3 - Find the error in the following pseudocode. Module...Ch. 3 - Find the error in the following pseudocode. Module...Ch. 3 - Find the potential error in the following...Ch. 3 - Prob. 4DECh. 3 - Kilometer Converter Design a modular program that...Ch. 3 - Prob. 2PECh. 3 - How Much Insurance? Many financial experts advise...Ch. 3 - Prob. 4PECh. 3 - Prob. 5PECh. 3 - Prob. 6PECh. 3 - Calories from Fat and Carbohydrates A nutritionist...Ch. 3 - Prob. 8PECh. 3 - Prob. 9PECh. 3 - Monthly Sales Tax A retail company must file a...Ch. 3 - Prob. 11PE
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Passwords, again Learning objectives In this lab, you will practice: writing a function to match the specifications using string concatenation to generate a new return value writing your code a module Instructions Write a function create_password(pet_name, fav_number) that will return a password with the following pattern: : fav_number followed by the pet_name followed by the underscore and fav_number (see example below). Create a program that reads pet name and favorite number from the user, uses the function above, and uses the return value to output: Your new password is "3Angel_3". Example Input: Angel 3 Output: Your new password is "3Angel_3". Note: Your program must define and call the following function: def create_password(pet_name, fav_number) Please use the form if_nane_=='_main_' # Define your function here. if __name__ == '__main__': # Type your code here.arrow_forwardJAVA PROGRAM In this lab, you will use what you have learned about accumulating totals in a single-level control break program to complete a Java program. The program should produce a report for a supermarket manager to help her keep track of the hours worked by her part-time employees. The report should include the day of the week and the total hours worked by all employees each day. Expected output is attached below. Instructions Study the prewritten code to understand what has already been done. Write the control break code, including the code for the dayChange() method, in the main() method. Execute this program using the following input values: Monday – 6 hours (employee 1), 3 hours (employee 2), 4 hours (employee 3) Tuesday – 4 hours (employee 1), 2 hours (employee 2) Wednesday – 2 hours (employee 1), 4 hours (employee 2), 6 hours (employee 3) Thursday – 4 hours (employee 1) Friday – 3 hours (employee 1), 4 hours (employee 2), 3 hours (employee 3) Saturday – 7 hours (employee…arrow_forwardJAVA PROGRAM Introduction The goal of this project is to develop a nontrivial computer program in the Java language by applying elementary programming language concepts learned so far. Specifically, the concepts to be used for this project include simple input/output, selection, iteration (loops), and possibly one-dimensional arrays (although the use of arrays is not required for completing this project). Developing a Java program for printing a calendar Statement of Problem: Develop a Java program to print a calendar for the year that the user will provide as an input to the program. Use the Eclipse IDE (on a Windows or Mac machine). Your program must fulfill the following requirements: Your program should prompt and receive as input an integer value representing the year for which the user wishes to have a calendar printed. This integer must be in the range from 1780 through 2040. In case the user input a year that is outside this range, your program must print out a message such as…arrow_forward
- Java programming Project 1 had all the calculations occurring in the main program. For this project, you are to modularize your program. Use functions as much as you can and use Arrays for your menu. be sure that the names you come up with for your modules are verbs and follow case conventions. Please do not create a function for every single input or calculation! Programmers group statements together that accomplish one task, such as getting input from the user and name them appropriately, such as getInput. Make sure every input display cost or money owed. The results of running your program should be identical to the results you obtained in Project 1 (either your original version or a corrected version if there were errors). If the money given is not enough, make sure you loop back or with decision structure to ask for more money. This is project 1: // Project 1 //// This program is designed to take a customers food order and generate a recipt displaying their purchase, the…arrow_forwardWeighted Job Scheduling in C language only please Problem statement: You are given a list of jobs where each job has a start time, finish time, and the profit associated with that job, find the maximum profit subset of non-overlapping jobs. Problem description: The problem wants you to find the maximum profit that you can make after performing a certain number of jobs such that each job has a certain condition that you can start a job only if the start time of the current job is greater than the finish time of the previous job. You are required to develop some algorithm such that the job start time and the finish time does not coincide with other jobs. Output: (Attached photo)arrow_forwardPuTTY/Ocelot Assignment #2 Instructions: (using C language in the UNIX environment, Systems Programming) Through this programming assignment, the students will learn to do the following: Usage: mortgagepmt [-s] -r rate [-d downpayment] price In this assignment, you are asked to perform a mortgage payment calculation. All information needed for this will be passed to the program on the command line. There will be no user input during the execution of the program You will need a few pieces of information. The price of the home and the amount of the down payment. You will also need to know the interest rate and the term of the mortgage. To figure your mortgage payment, start by converting your annual interest rate to a monthly interest rate by dividing by 12. Next, add 1 to the monthly rate. Third, multiply the number of years in the term of the mortgage by 12 to calculate the number of monthly payments you'll make. Fourth, raise the result of 1 plus the monthly rate to the…arrow_forward
- -. The popular expression "Divide-And-Conquer" refers to a kind of A Top-down design B Object oriented design C Algorithmic design D Modular designarrow_forwardJava code The Seattle Party Cruise Company owns a fleet of boats that they use to host parties on Lake Washington and Lake Union. A customer books a boat for an evening event, and the company provides the sailing and serving crew and all the necessary food and drink for the event. The customer tells the company how many people will be attending, and the company must calculate how much food and drink to purchase and bring on board for the evening. The problem is that the company's employees have been calculating badly, sometimes running out before the end of the evening, and sometimes ending up with a lot left over. So, you have been hired by the Seattle Party Cruise Company to write a program to help employees properly stock their cruise boats for any given event. You need to write a command-line program that asks the employee how many adults, teenagers, and children will be attending the event. The program should then calculate how many soft drinks, glasses of champagne, slices of…arrow_forwardComputer Science C# Programming Object Orientation Please use Arrays or ArrayLists where appropriate Implement a menu driven program that has some operations for a food truck. A food truck has multiple food items as well as a menu which contains a selection of the food items which will be sold for that day. A maximum of 10 food items can appear on the menu for any day. For each food item keep a code, description, category, price and quantity in stock (code, description and category are not usually changed). Create a comma delimited text file called "items.txt" for 15 or more food items, indicating the item's description, category, price and quantity in stock. Read all the food items from the text file “Items.txt” Display all the food items available for this food truck. Continuously prompt the user for a food item’s code to be placed on the menu until the menu is full or the user enters -1. Note that only food items which have a positive quantity in stock may be added to…arrow_forward
- Convert to C# Language def Deposit(balance, pin): # Deposit function p = int(input("Enter the PIN: ")) # taking PIN from user if p == pin: # if PIN matches with actual PIN amount = float(input("Enter deposit amount: ")) # taking deposit amount from user balance += amount # adding deposit amount to balance else: # else (if PIN not matches) print("Incorrect PIN!!") # display message return balance # return balance def Withdraw(balance, pin): # Withdraw function p = int(input("Enter the PIN: ")) # taking PIN from user if p == pin: # if PIN matches with actual PIN amount = float(input("Enter withdraw amount: ")) # taking withdrawal amount from user if amount > balance:…arrow_forward4arrow_forwardCar Service MaintenanceCreate a program for car service maintenance. Based on numbers of months / distance travelled, the system will recommend for doing service as well as the parts to be changed. Finally, the system may generate the cost of service and items to be replaced. Hint# You can input the car model, owner name, number of months and distance travelled. Create a service schedule. For example, Servicing after every 10,000 km travelled or 6 months whichever comes first. The system should then generate the cost of service and items to be replaced. Use a random generator to generate the invoice number which is the combination of the date and the random number. (Hint# https://docs.python.org/3/library/random.html)Use appropriate prompts to input data and to present the output.Make sure you have the ID and name mentioned in the Jupyter Notebook or Python fileUpload the jupyter doc, python code in the link providedarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning