Hi, i a question on my school work assignment. Part one Examine the pseudocode s
ID: 674657 • Letter: H
Question
Hi, i a question on my school work assignment. Part one Examine the pseudocode sample, and explain what it does line by line.
Program : applyDiscount
Create variable productPrice as double
Create varible discount as double
Create variable wholesalePrice as double
productPrice= get value from user input
discountedPrice= productPrice * (1 -discount) if (discountedPrice < wholesalePrice)
discountedPrice= wholesalePrice)
end if
Display discountedPrice
End program
Second part Present a solution using pseudocode similar to what you saw in part 1
* Idenify the logic needed to select a payment option, and get payment details.
* The logic needs to capture the payment option from the user.
* Two options should be availble for the user to select from:
Electronic check with routing number and account number
Credit card with account number, expiration date and CVV code
The logic should check the selected option using a decision-making statement and provide the corresponding statements to capture the payment information based on the selection.
Explanation / Answer
#include<iostream>
using namespace std;
main()
{
float a,b,c,d,e,f,g,h,i,j,total,discounted_price;
cout<<"Please input price of first 1st item: ";
cin>>a;
cout<<"Please input price of first 2nd item: ";
cin>>b;
cout<<"Please input price of first 3rd item: ";
cin>>c;
cout<<"Please input price of first 4th item: ";
cin>>d;
cout<<"Please input price of first 5th item: ";
cin>>e;
cout<<"Please input price of first 6th item: ";
cin>>f;
cout<<"Please input price of first 7th item: ";
cin>>g;
cout<<"Please input price of first 8th item: ";
cin>>h;
cout<<"Please input price of first 9th item: ";
cin>>i;
cout<<"Please input price of first 10th item: ";
cin>>j;
total=a+b+c+d+e+f+g+h+i+j;
cout<<"The total non discounted price is: "<<total;
if (total>=1000);
{
discounted_price=(0.10*total+total);
cout<<"10% discount has been availed, your total bill is: "<<discounted_price;
}
else
discounted_price=(0.05*total+total);
cout<<"5% discount has been availed, your total bill is: "<<discounted_price;
system("pause>0");
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.