Search In
• More options...
Find results that contain...
Find results in...

# I Need pseudo code help

## Recommended Posts

Posted · Original PosterOP

calculate the tip amount and total cost on a given bill. The program will receive the following input from the user: Bill Amount (float) and Tip Percent (integer). The program will return the following to the user: Tip Amount (float) and Total Cost (float). In your design you will need to do the
following:

1.        Receive the input from the user
2.        Calculate the tip amount
3.        Calculate total cost
4.        Display the results

Example calculation:

Bill Amount: \$56.23
Tip Percent: 18%

Tip Amount: 56.23 * (18/100) = 10.12
Total Cost: 56.23 + 10.12 = 66.35

Design a program with pseudocode that solves this problem.

I just learning and im so lost ,i dont know what to do,and i cannot get no help from no one

##### Share on other sites

Well, you need 2 variables and a constant, the tip, then just write it out in plain English e.g,

var total as real

const tip as real = 18/100

var bill as real

input bill(56.23)

total = bill+ bill*tip

Output total

Always remember to indent and use sensible variable names.

##### Share on other sites

Well, you need 2 variables and a constant, the tip, then just write it out in plain English e.g,

var total as real

const tip as real = 18/100

var bill as real

input bill(56.23)

total = bill+ bill*tip

Output total

Always remember to indent and use sensible variable names.

I guess it depends on the language but the tip shouldn't/can't be constant if it is given by the user.

1474412270.2748842

##### Share on other sites

I guess it depends on the language but the tip shouldn't/can't be constant if it is given by the user.

I wrote that part before I fully read the OP, but it isn't hard to change it for a variable and to get user input.

##### Share on other sites

I wrote this in Python quickly

Bill = input ("Bill here: ")
Tip = float(Bill)*0.18
print "The Tip is: "+str(Tip)
print "The total bill is: " +str(Bill+Tip)

input ("\n\nPress Enter to Exit")

Setup: i5 4670k @ 4.2 Ghz, Corsair H100i Cooler, Corsair Vengeance Pro 16GB Ram @ 1600 Mhz, MSI Z87-GD65 Motherboard, Corsair GS700 2013 edition PSU, MSI GTX 770 Lightning, Samsung EVO 120 SSD + 2TB&1TB Seagate Barracudas, BenQ XL2411T Monitor, Sennheiser HD 598 Headphones + AntLion ModMic 4.0

##### Share on other sites
Posted · Original PosterOP

Thanks Chris this class is kicking my butt,and my teacher don't seem  like they have time to explain it to me

##### Share on other sites

Tell your teacher that pseudo code is pointless. Why write pseudo code when writing the real code is just as simple and easier for others to understand?

##### Share on other sites

Tell your teacher that pseudo code is pointless. Why write pseudo code when writing the real code is just as simple and easier for others to understand?

Because when you're designing algorithms later on, it helps to represent it in pseudocode for those looking at your papers that may not understand certain languages.

##### Share on other sites

Tell your teacher that pseudo code is pointless. Why write pseudo code when writing the real code is just as simple and easier for others to understand?

Pseudo code is far from pointless. It may not look so on very simple problems, but when approaching a problem that is going to turn into a couple of hundred or thousand lines of code it really makes the job easier.

80+ ratings certify electrical efficiency. Not quality.

## Create an account

Register a new account