Absolute C++
6th Edition
ISBN: 9780133970784
Author: Walter Savitch, Kenrick Mock
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 4, Problem 8PP
Write a
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Assume that name and age have been declared suitably for storing names (like "Abdullah", "Alexandra" and "Zoe") and ages respectively. Write some code that reads in a name and an age and then prints the message "The age of NAME is AGE." where NAME and AGE are replaced by the values read in for the variables name and age. For example, if your code read in "Rohit" and 70 then it would print out "The age of Rohit is 70.".
A place to buy candy is from a candy machine. A new candy machine is bought for the gym, but it is not working properly. The candy machine has four dispensers to hold and release items sold by the candy machine and a cash register. The machine sells four products — candies, chips, gum, and cookies—each of which is stored in a separate dispenser. You have been asked to write a program for this candy machine so that it can be put into operation.
The program should do the following:
Show the customer the different products sold by the candy machine
Let the customer make the selection
Show the customer the cost of the item selected
Accept money from the customer
Return change
Release the item, that is, make the sale
Note: java programming, please used given outline code
//Implement the blueprint of the Candy Machine
import java.util.*;
public class CandyMachine
{
// Each candy machine is made of 1 CashRegister and 4 Dispensers
CashRegistercashRegister;
Dispensercandy;…
Use your previous working Java program as a starting point (Project 3). Create another function that determines whether the customer should receive a discount. Assume your food truck gives a 10% discount on orders over $50 (the total BEFORE tax). If the order is eligible for a discount, then calculate and display the discount. If the order does not get a discount, then still display the discount, but it should be 0. Include a line before this that tells every customer that your business gives a 10% discount on all orders over $50 so they understand this part of their receipt.
You will also create two classes, one for existing project two called foodTrack and another class called foodDiscount that extends foodTrack.
This is project 3:
//initialize program
import java.util.Scanner;
public class Main
{
finalstatic String items[]=new String[]{"FRIES","CHEESESTEAK","BISCUIT","SALADBOWL","DONUTBOX","SALESTAX"};
finalstaticfloat…
Chapter 4 Solutions
Absolute C++
Ch. 4 - Write a program that converts from 24-hour...Ch. 4 - The area of an arbitrary triangle can be using the...Ch. 4 - Write a program that tells what coins to give out...Ch. 4 - Write a program that will read in a length in feet...Ch. 4 - Write a program like that of the previous exercise...Ch. 4 - (You should do the previous two programming...Ch. 4 - Write a program that will read a weight in pounds...Ch. 4 - Write a program like that of the previous exercise...Ch. 4 - (You should do the previous two programming...Ch. 4 - (You should do Programming Projects 4.6 and 4.9...
Ch. 4 - You are a contestant on a game show and have won a...Ch. 4 - In the land of Puzzlevania, Aaron, Bob, and...Ch. 4 - You would like to know how fast you can run in...Ch. 4 - Your time machine is capable of going forward in...Ch. 4 - Write a function named convertToLowestTerms that...Ch. 4 - Consider a text file named scores. txt that...Ch. 4 - Given the scores . txt file described in...Ch. 4 - Write a function named sort that takes three...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Fill in the blanks in each of the following: A(n) is not required if you always refer to a class its fully qual...
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
The data shown in the following graph was collected during testing of an electromagnetic mass driver. The energ...
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
Write code that prompts the user to enter a positive nonzero number and validates the input.
Starting Out with Python (4th Edition)
This optional Google account security feature sends you a message with a code that you must enter, in addition ...
SURVEY OF OPERATING SYSTEMS
Largest Number Assume that a file containing a series of integers is named numbers.dat and exists on the comput...
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
TestScores Class Design a TestScores class that has fields to hold three test scores. The class should have a c...
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
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
- Must show it in Python:Please show step by step with comments.Please show it in simplest form.Please don't use any functionsPlease don't use any def func ()Input and Output must match with the QuestionPlease go through the Question very carefully.arrow_forwardMust show it in Python:Please show step by step with comments.Please show it in simplest form.Please don't use any functionsPlease don't use any def func ()Input and Output must match with the QuestionPlease go through the Question very carefully.arrow_forwardYou need to write a program that analyses the savings of a child who wants to buy a bike. Your program needs to get the initial saving, the number of weeks the analysis will be done and it will report the amount of savings at the end of the number of weeks entered and it will also make an assessment of the savings. Your program will have two functions to complete the task: f. double savings (int w, double initial savings):Assume that the child can save 20 TL per week and the amount of savings in the current week compared to the previous week is: savings (w) = 1.1savings (w-1) + 20 Write a recursive function that computes the total amount of savings at the end of week, w with the initial amount of savings given to the function. Please note that in week 0, your total amount of savings is the initial_savings given to the function. And In every week, you receive 1% increment of your savings because they are deposited in the bank. void analysis (double savings, int bike_price): This…arrow_forward
- Must show it in Python:Please show step by step with comments.Please show it in simplest form.Please don't use any functionsPlease don't use any def func ()Input and Output must match with the QuestionPlease go through the Question very carefully.arrow_forwardProblem: Write a program for computing the amount of money in a bank account at the end of each quarter for a period of one year. A quarter is equivalent to 3 months. Assume that the account is created at the beginning of a year (i.e. January 1). The year will be entered at run time through the keyboard. The account has an initial principal that is entered at run time through the keyboard. No deposit or withdrawal is made within the one-year period. The interest is compounded quarterly which means that the interest earned for the first quarter will form part of the principal for the second quarter, the interest earned for the second quarter will form part of the principal for the third quarter and so on. The annual interest rate is 5%. The interest rate for a quarter is computed by dividing the annual interest rate by 4 since there are four quarters in a year. The computational procedure (see algorithm) and the output of the program (see sample run) are shown below. The output includes…arrow_forwardNeed python help running code and others. Functions are ideal for use in menu-driven programs. When the user selects an item from a menu, the program can call the appropriate function. Write a menu-driven program for Burgers. Display the food menu to a user (Just show the 5 options' names and prices - No need to show the details!) Use numbers for the options and the number "6" to exit. If the user enters "6", your code should not ask any other questions, just show a message like "Thank you, hope to see you again!" Ask the user what he/she wants and how many of them. (Check the user inputs) Keep asking the user until he/she chooses the exit option. Use a data structure to save the quantities of the orders. You should use ArrayLists/Array Bags, or LinkedLists/LinkedBags (one or more of them) to save data. Calculate the price. Ask the user whether he/she is a student or a staff. There is no tax for students and a 9% tax for staff. Add the tax price to the total price.…arrow_forward
- Use C++ Please do not copy and paste the same answer that is found on google. I have tried to get this to compile in visual studio and it always fails.arrow_forwardI can't seem to figure this out.. for python You have a business that cleans floors in commercial space and offices. You charge customers $0.45 per square yard, and some customers require multiple cleanings every month. You need two custom functions for your business. The first function takes a floor's length and width in feet and returns the area in square yards. The second void function takes the area, charge per square yard, and number of monthly cleanings as arguments and prints the cleaning cost. This latter function uses selection logic to print different output for single and multiple monthly cleanings (see Sample Outputs). Use a properly named constant for the charge per square yard, too.arrow_forwardMust show it in Python:Please show step by step with comments.Please show it in simplest form.Please don't use any functionsPlease don't use any def func ()Input and Output must match with the QuestionPlease go through the Question very carefully.arrow_forward
- Hello, I was wondering if I could get help with this. The language I am using is Pythonarrow_forwardWrite this in C program. provide the source code and a screenshot that it is working. thank you!arrow_forwardpython solution please Task 1Description let's consider a case when you need a lot of coffee. Maybe you're hosting a party with a lot of guests! In these circumstances, it's better to make preparations in advance.So, we will ask a user to enter the desired amount of coffee, in cups. Given this, you can adjust the program by calculating how much water, coffee, and milk are necessary to make the specified amount of coffee.Of course, all this coffee is not needed right now, so at this stage, the coffee machine doesn't actually make any coffee yet. ObjectivesLet's break the task into several steps:First, read the numbers of coffee drinks from the input.Figure out how much of each ingredient the machine will need. Note that one cup of coffee made on this coffee machine contains 200 ml of water, 50 ml of milk, and 15 g of coffee beans.Output the required ingredient amounts back to the user. ExamplesThe greater-than symbol followed by space (> ) represents the user input. Notice that…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
What Are Data Types?; Author: Jabrils;https://www.youtube.com/watch?v=A37-3lflh8I;License: Standard YouTube License, CC-BY
Data Types; Author: CS50;https://www.youtube.com/watch?v=Fc9htmvVZ9U;License: Standard Youtube License