C++ Program - Computer Science
Program 1: Shipping Fees
The Acme Company sells Widgets at $2.00 each. A customer has the following options for shipping:
Ground Delivery: 7 to 10 days $ 5.00
Express Delivery:
3. 2 days $ 10.00
4. Overnight $ 20.00
Write a program using the steps in the lecture titled Even More Algorithm Practice from this module.
Be sure to do the following:
Prompt the User for how many Widgets they wish to purchase.
Error check the input to make sure that its not zero.
Use an outer IF/ELSE where the IF is used to display an error message if the input is zero and the ELSE is used for steps 3 through 12 below and for printing the receipt.
Prompt the User for the delivery option.
Compute the sub-total cost of the Widgets.
Compute sales tax on the sub-total cost of the Widgets. Use 8\%.
Compute the total cost of the Widgets.
Determine the delivery cost.
Use an IF/ELSE structure to determine Ground or Express fee.
Nest an inner IF within the Express option to determine the 2 day or overnight fee.
Once the shipping fee has been selected, add it to the total cost of the Widgets.
Format all dollar amounts with two decimal places and add a dollar sign to each one.
Format the sales tax with two decimal places.
Only print out the receipt if the number of widgets is valid.
Print out the receipt showing the following:
Number of Widgets:
Sub-Total Cost:
Sales Tax:
Sub-Total with Tax:
Shipping Fee:
Total Cost:
You will also need to do the following for the prologue section:
Create an initial algorithm of the basic steps.
Develop the refined algorithm from the initial algorithm.
Be sure to include with your program as documentation:
The Program Prologue
The Input data
The Output data
Any Formulas you may have.
The Initial Algorithm
The Refined Algorithm
Line-by-line documentation within the body of code.
The code to pause your output screen.
NOTE 1:
DO NOT use the return code, end, break, continue, or exit to force an exit from within your IF/ELSE structure.
Let the program progress to the end of the main function.
The end of the main function is the only place that the “return” should be placed.
A switch statement is the only place that the break command should be placed.
NOTE 2:
1. Declare all variables within the data declaration section of each class and method. (-5)
2 Do not get input on the same line as a variable declaration. (-5)
3. Do not place an equation for computation on the same line as declaring a variable. (-5)
4. Do not place an equation for computation on the same line as input. (-5)
Program 1: Shipping Fees
The Acme Company sells Widgets at $2.00 each. A customer has the following options for shipping:
Ground Delivery: 7 to 10 days $ 5.00
Express Delivery:
3. 2 days $ 10.00
4. Overnight $ 20.00
Write a program using the steps in the lecture titled Even More Algorithm Practice from this module.
Be sure to do the following:
Prompt the User for how many Widgets they wish to purchase.
Error check the input to make sure that its not zero.
Use an outer IF/ELSE where the IF is used to display an error message if the input is zero and the ELSE is used for steps 3 through 12 below and for printing the receipt.
Prompt the User for the delivery option.
Compute the sub-total cost of the Widgets.
Compute sales tax on the sub-total cost of the Widgets. Use 8\%.
Compute the total cost of the Widgets.
Determine the delivery cost.
Use an IF/ELSE structure to determine Ground or Express fee.
Nest an inner IF within the Express option to determine the 2 day or overnight fee.
Once the shipping fee has been selected, add it to the total cost of the Widgets.
Format all dollar amounts with two decimal places and add a dollar sign to each one.
Format the sales tax with two decimal places.
Only print out the receipt if the number of widgets is valid.
Print out the receipt showing the following:
Number of Widgets:
Sub-Total Cost:
Sales Tax:
Sub-Total with Tax:
Shipping Fee:
Total Cost:
You will also need to do the following for the prologue section:
Create an initial algorithm of the basic steps.
Develop the refined algorithm from the initial algorithm.
Be sure to include with your program as documentation:
The Program Prologue
The Input data
The Output data
Any Formulas you may have.
The Initial Algorithm
The Refined Algorithm
Line-by-line documentation within the body of code.
The code to pause your output screen.
NOTE 1:
DO NOT use the return code, end, break, continue, or exit to force an exit from within your IF/ELSE structure.
Let the program progress to the end of the main function.
The end of the main function is the only place that the “return” should be placed.
A switch statement is the only place that the break command should be placed.
NOTE 2:
1. Declare all variables within the data declaration section of each class and method. (-5)
2 Do not get input on the same line as a variable declaration. (-5)
3. Do not place an equation for computation on the same line as declaring a variable. (-5)
4.
Do not place an equation for computation on the same line as input. (-5)
1. IF/ELSE IF/ELSE Syntax
IF/ELSE IF/ELSE Statements
IF/ELSE IF/ELSE statements are really just special cases of the IF/ELSE.
The basic syntax is as follows:
if (
logical_test_1
)
{
statement(s);
}
else if (
logical_test_2
)
{
statement(s);
}
else if (
logical_test32
)
{
statement(s);
}
.
. //you can keep putting as many else ifs as you need
.
else
{
statement(s);
}
Notice that you can have any number of ELSE IF clauses, or just one.
Also note that the above syntax example shows curly brackets around statement(s).
It is critical to remember that you must have curly brackets when you have more than one statement attached to any if/else if/ or else.
You do not need curly brackets if you only have one statement – however if you always include them then you don’t need to worry about forgetting for multiple statements.
When you use an ELSE IF structure, C++ will begin by evaluating the first condition.
If the first condition evaluates to False, then C++ will continue on and evaluate the second condition.
C++ will continue evaluating conditions in order UNTIL one of them evaluates to true.
AS SOON AS a condition evaluates to True, C++ will stop evaluating conditions and perform the statements within the statement block of the true condition.
It is critical that you understand that C++ will NOT evaluate any conditions after a true one is encountered.
C++ evaluates each condition in order and STOPS as soon as it encounters a true condition.
If none of the conditions is true, then the ELSE is executed.
NOTE: Do NOT use the break or the continue command in an IF/ELSE IF/ELSE structure.
2. IF/ELSE IF/ELSE Example
IF/ELSE IF/ELSE Exampl
e
if (GPA >= 3.9)
{
cout << Summa Cum Laude\n;
}
else if (GPA >= 3.7)
{
cout << Magna Cum Laude\n;
}
else if (GPA >= 3.5)
{
cout << Cum Laude\n;
}
else
{
cout << No graduation honors\n;
}
Let’s say that GPA contains a 3.95.
The first condition will be tested and the result will be true.
Since the result is true then the output will be “Summa Cum Laude.”
The other conditions will NOT be tested – they will be skipped.
Now let’s see what happens if GPA contains a 3.8.
The first condition is tested.
Since 3.8 is not greater or equal to 3.9 then the result of this test is a false.
The second condition is then tested. The result is now true so the output will be “Magna Cum Laude.”
The remaining conditions will be skipped.
What happens if the GPA is 2.0?
The first condition is tested and the result is false.
The second and third conditions are tested in turn – with each test resulting in a value of false.
Since all conditions resulted in false, the else is then executed and the output will be “No graduation honors.”
Switch Structure
The next selection structure that we are going to explore is the Switch Structure. With the Switch Structure, a variable is compared to a list of values. The comparisons are made down the list until a true is found. Once the result of the comparison is true – no more comparisons occur.
The logic of this structure is similar to the If/Else If/Else structure in that :
Only one comparison can result in true.
No further comparisons are made once a true is found.
If you set up your Switch Structure such that more than one comparison could be true you will have a logic error which will produce incorrect results.
The syntax for the Switch Structure is as follows:
switch (
selector
)
{
case
label
1
:
statement
1.1
;
statement
1.2
;
break;
case
label
2
:
statement
2.1
;
statement
2.2
;
break;
case
label
3
:
.
.
.
default:
statement
d.1
;
statement
d.2
;
Things to remember:
The
selector
must be an integer (int), character (char), or Boolean (bool) data type.
The entire body of the Switch is contained between a set of curly brackets { } .
Each
label
must be a unique value. However, multiple cases may be used on the same line, but they must be separated by colons ( : ).
Each case clause ends with a
break
statement. If you omit the
break
the next case will automatically be executed.
Unlike the If structures, a Switch case does not need its own set of curly brackets.
Just like the If statement has an else clause, the Switch has a default clause. It is not required, but may be used as the “catch-all.” The default clause does not end with a
break
statement.
Here is an example of a Switch Structure:
switch (grade)
{
case a: case A:
cout << Outstanding << endl;
qualityPoints = 4.0;
break;
case b: case B:
cout << Good Job << endl;
qualityPoints = 3.0;
break;
case c: case C:
cout << Passing Grade << endl;
qualityPoints = 2.0;
break;
default:
cout << You did not enter a passing grade << endl;
}
Notice that this example demonstrates the use of multiple cases separated by colons. Each case has an individual and unique label.
NOTE: ONLY use the break command for the Switch/Case statements. DO NOT use it for any IF structures or looping structures.
5. Even More Algorithm Practice
Steps for Developing an Algorith
m
Let’s now go through the steps to develop an algorithm for computing shipping fees - which is the Program 1 assignment. Here is the problem:
Have the Customer input the number of Widgets they wish to purchase.
If the Customer input a zero then display a message that states they did not enter a valid number of Widgets.
Else, if the Customer input a number of Widgets greater than zero:
Display a menu for delivery options:
1. Ground Delivery
2. Express Delivery
Prompt the Customer for the delivery option.
If the Customer selects 1 then the shipping fee is $5.00
Else if the Customer selects 2 then display the following:
3. Two Days
4. Overnight
If the Customer selects 3 then the shipping fee is $10.00
Else if the Customer selects 4 then the shipping fee is $20.00
Compute the sub-total of the Widgets.
Compute the sales tax of the Widgets at 8\%.
Compute the total cost of the Widgets.
Add the total cost of the Widgets to the shipping fees.
Display the receipt. Include sub-total, sales tax, total cost for the Widgets, the shipping fees, and the total cost of the order.
Be sure to do the following if the Customer does not enter a valid number of Widgets:
Do not display anything other than the error message.
Do not compute any costs or shipping fees.
Do not compute any shipping fees.
Steps for setting up the program
.
1. The first step was to create an Initial Algorithm that will outline the basic steps needed to write this program:
How will you solve this problem?
You need to know the how many Widgets the customer wants to purchase. Make sure the number of Widgets is not zero.
You need to know the delivery option the customer wants. Make sure the customer enters a valid delivery option and not zero.
You will then charge $2.00 for each Widget.
Then compute the sales tax at 8\%.
Compute the total cost of the Widgets.
Add the shipping fee to the total cost of the Widgets.
You then display the number of Widgets, the sub-total, the sales tax, the total cost of Widgets, the shipping fee, and the total cost of the order.
Take these statements and convert them to an outline of the basic steps:
Get the number of Widgets from the customer and check to make sure its not zero.
If the number of Widgets is not equal to zero then prompt the customer for ground delivery or overnight delivery.
If the customer entered a 1 then the shipping fee is $5.00.
Else if the customer entered a 2 then prompt the customer for 2 day delivery or overnight.
If the customer entered a 3 then the shipping fee is $10.00.
Else if the customer entered a 4 then the shipping fee is $20.00
Compute the cost of the Widgets, the sales tax, the total cost of Widgets, and the total cost of the order.
Display the number of Widgets, the sub-total, the sales tax, the total cost of Widgets, the shipping fee, and the total cost of the order.
2. Next we list the Data Requirements
:
Begin with the input - the data you need to get in order to solve the problem. We will also list the name we will give each item and the data type.
Input:
Input Dat
a
Descriptio
n
Variable Nam
e
Data Typ
e
Number of Widgets
Total number of Widgets the customer purchases.
widgets
int
Delivery Option
The delivery option that the customer wants.
delivery
int
Now we determine the data that we will be displaying. This will be our output.
Output:
Output Dat
a
Descriptio
n
Variable Nam
e
Data Typ
e
Number of Widgets
Total number of Widgets the customer purchases.
widgets
int
Cost of Widgets
Sub-total cost
subTotal
double
Sales Tax
Tax for Widgets
salesTax
double
Total Cost of Widgets
Sub-total + tax
totalCost
double
Shipping Fee
Fee for delivery option
shippingFee
double
Total Order
Cost of entire order
orderCost
double
Additional:
Additonal Dat
a
Descriptio
n
Variable Nam
e
Data Typ
e
Tax Rate
Tax rate as a decimal
taxRate
double
Ground Rate
Ground delivery option
ground
double
Two Day Rate
Two Day delivery option
twoDay
double
Overnight Rate
Overnight deliver option
overnight
double
Cost of one Widget
The price of one Widget
widgetPrice
double
3. Formulas
:
We also list out any formulas we need.
Data Typ
e
Resul
t
Formul
a
double
subTotal
widgets * widgetPrice
double
salesTax
subTotal * taxRate
double
totalCost
subTotal + salesTax
double
orderCost
totalCost + shippingFee
4. Create a Refined Algorithm
:
We start with the Initial Algorithm and fill in the details of HOW each step will be executed to create our Refined Algorithm.
Prompt the customer for the number of Widgets
Scan the number.
IF the customer entered a zero then
Display an error message
ELSE
Prompt the customer for ground delivery or overnight delivery.
IF the customer entered a 1 then
The shipping fee is $5.00.
ELSE
Prompt the customer for 2 day delivery or overnight.
IF the customer entered a 3 then the shipping fee is $10.00.
ELSE
The shipping fee is $20.00
END IF step i.
END IF step b
Compute the cost of the Widgets.
Subtotal = widgets * widgetPrice
Compute the sales tax.
salesTax = subTotal * taxRate
Compute the total cost of Widgets
totalCost = subTotal + salesTax
Compute and the total cost of the order.
orderCost = totalCost + shippingFee
Display the number of Widgets, the sub-total, the sales tax, the total cost of Widgets, the shipping fee, and the total cost of the order.
END IF step 2
Note the use of indentation in the refined algorithm.
This shows where you would place code within each IF or ELSE section.
If you don’t keep the indented sections within the code for the IF and the ELSE sections then the logic will not be correct.
Also notice the section of the algorithm that is indented for step 3.
None of this should be executed if the customer enters a zero for the number of Widgets.
That is the purpose of the ELSE in step 3.
CATEGORIES
Economics
Nursing
Applied Sciences
Psychology
Science
Management
Computer Science
Human Resource Management
Accounting
Information Systems
English
Anatomy
Operations Management
Sociology
Literature
Education
Business & Finance
Marketing
Engineering
Statistics
Biology
Political Science
Reading
History
Financial markets
Philosophy
Mathematics
Law
Criminal
Architecture and Design
Government
Social Science
World history
Chemistry
Humanities
Business Finance
Writing
Programming
Telecommunications Engineering
Geography
Physics
Spanish
ach
e. Embedded Entrepreneurship
f. Three Social Entrepreneurship Models
g. Social-Founder Identity
h. Micros-enterprise Development
Outcomes
Subset 2. Indigenous Entrepreneurship Approaches (Outside of Canada)
a. Indigenous Australian Entrepreneurs Exami
Calculus
(people influence of
others) processes that you perceived occurs in this specific Institution Select one of the forms of stratification highlighted (focus on inter the intersectionalities
of these three) to reflect and analyze the potential ways these (
American history
Pharmacology
Ancient history
. Also
Numerical analysis
Environmental science
Electrical Engineering
Precalculus
Physiology
Civil Engineering
Electronic Engineering
ness Horizons
Algebra
Geology
Physical chemistry
nt
When considering both O
lassrooms
Civil
Probability
ions
Identify a specific consumer product that you or your family have used for quite some time. This might be a branded smartphone (if you have used several versions over the years)
or the court to consider in its deliberations. Locard’s exchange principle argues that during the commission of a crime
Chemical Engineering
Ecology
aragraphs (meaning 25 sentences or more). Your assignment may be more than 5 paragraphs but not less.
INSTRUCTIONS:
To access the FNU Online Library for journals and articles you can go the FNU library link here:
https://www.fnu.edu/library/
In order to
n that draws upon the theoretical reading to explain and contextualize the design choices. Be sure to directly quote or paraphrase the reading
ce to the vaccine. Your campaign must educate and inform the audience on the benefits but also create for safe and open dialogue. A key metric of your campaign will be the direct increase in numbers.
Key outcomes: The approach that you take must be clear
Mechanical Engineering
Organic chemistry
Geometry
nment
Topic
You will need to pick one topic for your project (5 pts)
Literature search
You will need to perform a literature search for your topic
Geophysics
you been involved with a company doing a redesign of business processes
Communication on Customer Relations. Discuss how two-way communication on social media channels impacts businesses both positively and negatively. Provide any personal examples from your experience
od pressure and hypertension via a community-wide intervention that targets the problem across the lifespan (i.e. includes all ages).
Develop a community-wide intervention to reduce elevated blood pressure and hypertension in the State of Alabama that in
in body of the report
Conclusions
References (8 References Minimum)
*** Words count = 2000 words.
*** In-Text Citations and References using Harvard style.
*** In Task section I’ve chose (Economic issues in overseas contracting)"
Electromagnetism
w or quality improvement; it was just all part of good nursing care. The goal for quality improvement is to monitor patient outcomes using statistics for comparison to standards of care for different diseases
e a 1 to 2 slide Microsoft PowerPoint presentation on the different models of case management. Include speaker notes... .....Describe three different models of case management.
visual representations of information. They can include numbers
SSAY
ame workbook for all 3 milestones. You do not need to download a new copy for Milestones 2 or 3. When you submit Milestone 3
pages):
Provide a description of an existing intervention in Canada
making the appropriate buying decisions in an ethical and professional manner.
Topic: Purchasing and Technology
You read about blockchain ledger technology. Now do some additional research out on the Internet and share your URL with the rest of the class
be aware of which features their competitors are opting to include so the product development teams can design similar or enhanced features to attract more of the market. The more unique
low (The Top Health Industry Trends to Watch in 2015) to assist you with this discussion.
https://youtu.be/fRym_jyuBc0
Next year the $2.8 trillion U.S. healthcare industry will finally begin to look and feel more like the rest of the business wo
evidence-based primary care curriculum. Throughout your nurse practitioner program
Vignette
Understanding Gender Fluidity
Providing Inclusive Quality Care
Affirming Clinical Encounters
Conclusion
References
Nurse Practitioner Knowledge
Mechanics
and word limit is unit as a guide only.
The assessment may be re-attempted on two further occasions (maximum three attempts in total). All assessments must be resubmitted 3 days within receiving your unsatisfactory grade. You must clearly indicate “Re-su
Trigonometry
Article writing
Other
5. June 29
After the components sending to the manufacturing house
1. In 1972 the Furman v. Georgia case resulted in a decision that would put action into motion. Furman was originally sentenced to death because of a murder he committed in Georgia but the court debated whether or not this was a violation of his 8th amend
One of the first conflicts that would need to be investigated would be whether the human service professional followed the responsibility to client ethical standard. While developing a relationship with client it is important to clarify that if danger or
Ethical behavior is a critical topic in the workplace because the impact of it can make or break a business
No matter which type of health care organization
With a direct sale
During the pandemic
Computers are being used to monitor the spread of outbreaks in different areas of the world and with this record
3. Furman v. Georgia is a U.S Supreme Court case that resolves around the Eighth Amendments ban on cruel and unsual punishment in death penalty cases. The Furman v. Georgia case was based on Furman being convicted of murder in Georgia. Furman was caught i
One major ethical conflict that may arise in my investigation is the Responsibility to Client in both Standard 3 and Standard 4 of the Ethical Standards for Human Service Professionals (2015). Making sure we do not disclose information without consent ev
4. Identify two examples of real world problems that you have observed in your personal
Summary & Evaluation: Reference & 188. Academic Search Ultimate
Ethics
We can mention at least one example of how the violation of ethical standards can be prevented. Many organizations promote ethical self-regulation by creating moral codes to help direct their business activities
*DDB is used for the first three years
For example
The inbound logistics for William Instrument refer to purchase components from various electronic firms. During the purchase process William need to consider the quality and price of the components. In this case
4. A U.S. Supreme Court case known as Furman v. Georgia (1972) is a landmark case that involved Eighth Amendment’s ban of unusual and cruel punishment in death penalty cases (Furman v. Georgia (1972)
With covid coming into place
In my opinion
with
Not necessarily all home buyers are the same! When you choose to work with we buy ugly houses Baltimore & nationwide USA
The ability to view ourselves from an unbiased perspective allows us to critically assess our personal strengths and weaknesses. This is an important step in the process of finding the right resources for our personal learning style. Ego and pride can be
· By Day 1 of this week
While you must form your answers to the questions below from our assigned reading material
CliftonLarsonAllen LLP (2013)
5 The family dynamic is awkward at first since the most outgoing and straight forward person in the family in Linda
Urien
The most important benefit of my statistical analysis would be the accuracy with which I interpret the data. The greatest obstacle
From a similar but larger point of view
4 In order to get the entire family to come back for another session I would suggest coming in on a day the restaurant is not open
When seeking to identify a patient’s health condition
After viewing the you tube videos on prayer
Your paper must be at least two pages in length (not counting the title and reference pages)
The word assimilate is negative to me. I believe everyone should learn about a country that they are going to live in. It doesnt mean that they have to believe that everything in America is better than where they came from. It means that they care enough
Data collection
Single Subject Chris is a social worker in a geriatric case management program located in a midsize Northeastern town. She has an MSW and is part of a team of case managers that likes to continuously improve on its practice. The team is currently using an
I would start off with Linda on repeating her options for the child and going over what she is feeling with each option. I would want to find out what she is afraid of. I would avoid asking her any “why” questions because I want her to be in the here an
Summarize the advantages and disadvantages of using an Internet site as means of collecting data for psychological research (Comp 2.1) 25.0\% Summarization of the advantages and disadvantages of using an Internet site as means of collecting data for psych
Identify the type of research used in a chosen study
Compose a 1
Optics
effect relationship becomes more difficult—as the researcher cannot enact total control of another person even in an experimental environment. Social workers serve clients in highly complex real-world environments. Clients often implement recommended inte
I think knowing more about you will allow you to be able to choose the right resources
Be 4 pages in length
soft MB-920 dumps review and documentation and high-quality listing pdf MB-920 braindumps also recommended and approved by Microsoft experts. The practical test
g
One thing you will need to do in college is learn how to find and use references. References support your ideas. College-level work must be supported by research. You are expected to do that for this paper. You will research
Elaborate on any potential confounds or ethical concerns while participating in the psychological study 20.0\% Elaboration on any potential confounds or ethical concerns while participating in the psychological study is missing. Elaboration on any potenti
3 The first thing I would do in the family’s first session is develop a genogram of the family to get an idea of all the individuals who play a major role in Linda’s life. After establishing where each member is in relation to the family
A Health in All Policies approach
Note: The requirements outlined below correspond to the grading criteria in the scoring guide. At a minimum
Chen
Read Connecting Communities and Complexity: A Case Study in Creating the Conditions for Transformational Change
Read Reflections on Cultural Humility
Read A Basic Guide to ABCD Community Organizing
Use the bolded black section and sub-section titles below to organize your paper. For each section
Losinski forwarded the article on a priority basis to Mary Scott
Losinksi wanted details on use of the ED at CGH. He asked the administrative resident