Jump to content

Since I literally understand nothing this teacher says & it's a required class, I need help with this problem:

 

Write a program that will calculate a XXX% tip and a 8.25% tax on a meal price.  The user will enter the meal price and the program will calculate tip, tax, and the total.  The total is the meal price plus the tip plus the tax.  Your program will then display the values of tip, tax, and total.

 

 

In pseudocode & python please 

Link to comment
https://linustechtips.com/topic/680360-help-with-pseudocode/
Share on other sites

Link to post
Share on other sites

2 hours ago, Emotionless marchers said:

Since I literally understand nothing this teacher says & it's a required class, I need help with this problem:

 

Write a program that will calculate a XXX% tip and a 8.25% tax on a meal price.  The user will enter the meal price and the program will calculate tip, tax, and the total.  The total is the meal price plus the tip plus the tax.  Your program will then display the values of tip, tax, and total.

 

 

In pseudocode & python please 

You'll need 2 primary variables. 'Price' and 'Tip'

Clarify one thing for me, is the tax added only to the price or is it tax after price+tip?

 

If it's tax before tip, just use this formula: (Price * 0.0825) + Tip + Price = Total {note I'm representing 8.25% in decimal}

If it's tax after tip, just use this formula: ((Price + Tip) * 0.0825) + (Price + Tip) = Total

 

Price * 0.0825 = Tax

or (Price + Tip) * 0.0825 = Tax

 

And then return the values of Price, Tip and Result.

 

I won't give you any reply in pseudocode or python.  You're the student, figure out how to write the code yourself.

That is not dead which can eternal lie.  And with strange aeons even death may die. - The Call of Cthulhu

A university is not a "safe space". If you need a safe space, leave, go home, hug your teddy & suck your thumb until ready for university.  - Richard Dawkins

Link to comment
https://linustechtips.com/topic/680360-help-with-pseudocode/#findComment-8750199
Share on other sites

Link to post
Share on other sites

26 minutes ago, AkiraDaarkst said:

Clarify one thing for me, is the tax added only to the price or is it tax after price+tip?

Tipping etiquette is usually 15 to 20 % of the non tax total however it is not set in stone just as the tipping amounts.

You are also right in the "figure it out" as how can you learn when someone hands you the answer.

 

No-one has ever returned from Z'ha'dum................

                  Did I help you to fix your problem or at least did offer somewhat valuable advice? Consider giving my post a "informative" or "thumbs up".

SYSTEM 2: Modded G3 case with Gigabyte GA-G33M-S2L, Intel E8600 (O.C to 4.2GHz.), 4GB GSkill PC8500, Nvidia 8800GTS (512M), Cooling provided by Scythe Big Shrunkin, HDD 1 = OSX 10.9.5, HDD 2 = Windows 7 Pro X64. (Placed 3rd in MacMod  of the year 2012) (For info see:  http://insanelymac.com/forum/topic/285641-and-the-winner-for-macmod-of-2012-is/

LAPTOP: Inspiron 1720, Modded BIOS, X9000 Core 2 extreme OC'ed and undervolted to 3.4GHz (windows only) , 6GB DDR2 800, 8600M GT, 1920x1200 Glossy display, Sigmatel Audio, 2 Kingston HyperX 120GB drives (1 with Windows 7 x64 pro & 1 with OSX 10.9.5) X9000 Processor World Record Holder since 02/2013 on Geekbench 2 : http://browser.primatelabs.com/geekbench2/search?dir=desc&q=x9000&sort=score

Link to comment
https://linustechtips.com/topic/680360-help-with-pseudocode/#findComment-8750338
Share on other sites

Link to post
Share on other sites

31 minutes ago, AkiraDaarkst said:

You'll need 2 primary variables. 'Price' and 'Tip'

Actually, you need four.

 

Start this way ... 

 

Cost = What it costs

Tip = a percent of the Cost (to add on later)

Tax = a percent of the Cost.(to add on later)

Price = What you pay (usually more than Cost) - the Sum of the above.

 

Write the math out in simple steps.  

That will be your psuedo code (pretty much).

Then translate to Python.

Link to comment
https://linustechtips.com/topic/680360-help-with-pseudocode/#findComment-8750339
Share on other sites

Link to post
Share on other sites

2 hours ago, Rohime said:

Actually, you need four.

 

Start this way ... 

 

Cost = What it costs

Tip = a percent of the Cost (to add on later)

Tax = a percent of the Cost.(to add on later)

Price = What you pay (usually more than Cost) - the Sum of the above.

 

Write the math out in simple steps.  

That will be your psuedo code (pretty much).

Then translate to Python.

Yeah I forgot he was also supposed to show the value of the tax being charged.  Corrected my formulas.  I'm just giving him hints on how he can write the code.

 

Anyway the reason I say 2 primary variables is because Price of the Meal and Tip are not generated by anyone.  Someone has to enter those values, while Tip and Total are derived from whatever is entered for Price and Tip.  You can argue that Price can be calculated from adding the individual items ordered, but the problem as stated by the OP doesn't mention creating a fully functional cash register system.  So I'll assume that someone has already added up the cost of every dish and drink ordered and just need to input the price into the system.

That is not dead which can eternal lie.  And with strange aeons even death may die. - The Call of Cthulhu

A university is not a "safe space". If you need a safe space, leave, go home, hug your teddy & suck your thumb until ready for university.  - Richard Dawkins

Link to comment
https://linustechtips.com/topic/680360-help-with-pseudocode/#findComment-8750848
Share on other sites

Link to post
Share on other sites

2 hours ago, zanthros said:

Tipping etiquette is usually 15 to 20 % of the non tax total however it is not set in stone just as the tipping amounts.

You are also right in the "figure it out" as how can you learn when someone hands you the answer.

 

No-one has ever returned from Z'ha'dum................

I don't believe in tipping and in the times that I do leave some tip, it's completely random.  Sometimes it's all the change I have in my pocket or whatever amount I feel like leaving.  I think tipping etiquette or any assumption that tipping should be mandatory is bullshit.

That is not dead which can eternal lie.  And with strange aeons even death may die. - The Call of Cthulhu

A university is not a "safe space". If you need a safe space, leave, go home, hug your teddy & suck your thumb until ready for university.  - Richard Dawkins

Link to comment
https://linustechtips.com/topic/680360-help-with-pseudocode/#findComment-8750870
Share on other sites

Link to post
Share on other sites

4 hours ago, AkiraDaarkst said:

I think tipping etiquette or any assumption that tipping should be mandatory is bullshit.

Nope, sorry - it depends on what country you are in - and LOCAL etiquette - not your assumptions.

 

Australians in Australia basically DONT tip ... except maybe for truly exceptional service - but the cost to pay people a decent wage is built into prices.   Service is generally "OK to Good".

 

Americans in America basically ALWAYS tip ... except maybe for truly BAD service - and the cost to pay people is not really built into base price of anything. Service is generally "Good to very good".

 

Australians in America get scorned if they forget to tip ... and the service provider may not be able to feed their family that night.

 

Americans in Australia get real thanks if they do tip - its usually unexpected.  Sometimes a tip will be declined, because the service provider will get paid anyway.

 

IE: "When in Rome do as the Romans do."

Link to comment
https://linustechtips.com/topic/680360-help-with-pseudocode/#findComment-8751993
Share on other sites

Link to post
Share on other sites

4 hours ago, Rohime said:

Nope, sorry - it depends on what country you are in - and LOCAL etiquette - not your assumptions.

 

Australians in Australia basically DONT tip ... except maybe for truly exceptional service - but the cost to pay people a decent wage is built into prices.   Service is generally "OK to Good".

 

Americans in America basically ALWAYS tip ... except maybe for truly BAD service - and the cost to pay people is not really built into base price of anything. Service is generally "Good to very good".

 

Australians in America get scorned if they forget to tip ... and the service provider may not be able to feed their family that night.

 

Americans in Australia get real thanks if they do tip - its usually unexpected.  Sometimes a tip will be declined, because the service provider will get paid anyway.

 

IE: "When in Rome do as the Romans do."

Well I'm not in Rome, nor am I a Roman.  I don't care whatever the customs should be anywhere.  If the servers don't like it, they can ask their employer for better wages which is their legal right.  Any tip I leave is out of generosity, not because it's a rule anywhere.

That is not dead which can eternal lie.  And with strange aeons even death may die. - The Call of Cthulhu

A university is not a "safe space". If you need a safe space, leave, go home, hug your teddy & suck your thumb until ready for university.  - Richard Dawkins

Link to comment
https://linustechtips.com/topic/680360-help-with-pseudocode/#findComment-8752602
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×