Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ language Hello! Please help me to write this codes for those problems! Thank you in advance! Purpose: 1. Understand the structure of a program

c++ language image text in transcribed

image text in transcribedHello! Please help me to write this codes for those problems! Thank you in advance!

Purpose: 1. Understand the structure of a program Be able to declare variables Be able to read input, storing to variables 2. 3. 4. Be able calculate and assign values using simple mathematical operations and assignment statements 5. Output results to the console/display in formatted form In this lab you will write a program to calculate values related to a group of people ordering donuts. Description In this scenario, there is a group of people who want to order donuts (or doughnuts, if you prefer). They decide to put all of their money together in order to buy as many donuts as possible. They want to distribute the donuts equally to everyone in the group, but no one in the group wants a partial donut. So, they have asked you to write a program that, given (entered by the program user) the number of people in the group, total money available, and cost per donut, calculates (and outputs) the maximum number of whole donuts that can be purchased, the money left over, how many whole donuts each person gets, and how many whole donuts left over. The sample run of what the program should look like is shown below, with user inputs in bold. How many people? 12 How much money does the group have? 22.78 How much does a donut cost? 0.89 With $22.78 you can purchase 25 donuts and have $0.53 left over. Each person gets 2 donuts and there will be 1 donuts left over. 3.1 Algorithm Development (3 points) Using the above description and output example, develop an algorithm using a flowchart or pseudocode. The steps that you will use will be in these categories: Prompt for a value Read and store a value Perform a math operation Print a message or value to the screen Additionally, make a list of the variables that you will use in your program (types and names). Give your variables descriptive names (example of a good name: donuts_per_person). Show your work to the TA before moving on to part 2 Purpose: 1. Understand the structure of a program Be able to declare variables Be able to read input, storing to variables 2. 3. 4. Be able calculate and assign values using simple mathematical operations and assignment statements 5. Output results to the console/display in formatted form In this lab you will write a program to calculate values related to a group of people ordering donuts. Description In this scenario, there is a group of people who want to order donuts (or doughnuts, if you prefer). They decide to put all of their money together in order to buy as many donuts as possible. They want to distribute the donuts equally to everyone in the group, but no one in the group wants a partial donut. So, they have asked you to write a program that, given (entered by the program user) the number of people in the group, total money available, and cost per donut, calculates (and outputs) the maximum number of whole donuts that can be purchased, the money left over, how many whole donuts each person gets, and how many whole donuts left over. The sample run of what the program should look like is shown below, with user inputs in bold. How many people? 12 How much money does the group have? 22.78 How much does a donut cost? 0.89 With $22.78 you can purchase 25 donuts and have $0.53 left over. Each person gets 2 donuts and there will be 1 donuts left over. 3.1 Algorithm Development (3 points) Using the above description and output example, develop an algorithm using a flowchart or pseudocode. The steps that you will use will be in these categories: Prompt for a value Read and store a value Perform a math operation Print a message or value to the screen Additionally, make a list of the variables that you will use in your program (types and names). Give your variables descriptive names (example of a good name: donuts_per_person). Show your work to the TA before moving on to part 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Progress Monitoring Data Tracking Organizer

Authors: Teacher'S Aid Publications

1st Edition

B0B7QCNRJ1

More Books

Students also viewed these Databases questions

Question

Explain how cultural differences affect business communication.

Answered: 1 week ago

Question

List and explain the goals of business communication.

Answered: 1 week ago