Quantcast

Jump to content


Pseudocode Help


  • Please log in to reply
7 replies to this topic

#1 Guest_idonotexist_*

Guest_idonotexist_*

Posted 14 September 2012 - 11:16 AM

Alright, so I'm in a CIT 120 Class. This assignment is about pseudocode and I just want to make sure I've done this correctly before submitting it.
Math is not my strong suit and this sort of stuff easily hurts my brain o_x So, I guess help me make sure I'm doing this correctly and if not, please tell me what I'm doing wrong. :)



1. Write the pseudocode for an application that allows a user to enter the number of minutes used on a cell phone and displays the phone bill. The calls cost 10 cents per minute plus 6% tax.
Spoiler



2. Write the pseudocode for an application that allows a user to enter the price of an item and computes 5 percent sales tax on the item
Spoiler



3. Write the pseudocode for an application that allows a user to enter the cost of home maintenance in each of the four seasons—summer, fall, winter, and spring—and displays the total.

Spoiler



4. Write the pseudocode for an application that allows a student to enter scores for four classroom assignments and displays the numeric average.

Spoiler



5. Write the pseudocode for an application that allows a user to enter a credit card balance. Assuming the interest rate is 1 percent per month and that the user makes no payments, display the amount that will be due after one month and after two months.

Spoiler



Don't tear me to shreds too badly. xD I'm just learning this stuff.

#2 Sweeney

Sweeney
  • 1230 posts


Users Awards

Posted 14 September 2012 - 11:22 AM

For the ones with tax where you're calculating and adding, you can just add a 1 to the decimal calculation and save a whole step.
Eg, in 1, instead of:
num taxAmount = .06
salesTax = initialCost * taxAmount
totalBill = salesTax + initialCost
Just use:
num taxAmount = 1.06
totalBill = initialCost * taxAmount

I also don't understand why you have a paymentAmount variable in #5 when the task states that there are no payments.

#3 Guest_idonotexist_*

Guest_idonotexist_*

Posted 14 September 2012 - 11:29 AM

For the ones with tax where you're calculating and adding, you can just add a 1 to the decimal calculation and save a whole step.
Eg, in 1, instead of:

num taxAmount = .06
salesTax = initialCost * taxAmount
totalBill = salesTax + initialCost
Just use:
num taxAmount = 1.06
totalBill = initialCost * taxAmount

I also don't understand why you have a paymentAmount variable in #5 when the task states that there are no payments.


Hmmm

So this?


start
// Delcarations
num minUsed
num costPerMin = .10
num initialCost
num taxAmount = 1.06
num totalBill
input minUsed
initialCost = costPerMin * minUsed
totalBill = initialCost * taxAmount
output totalBill
stop

Well, I wasn't sure if he still wanted the option for a payment amount or not. xD
I over analyze things sometimes.

#4 Sweeney

Sweeney
  • 1230 posts


Users Awards

Posted 14 September 2012 - 11:37 AM

Less code is better code ^_^

#5 Waser Lave

Waser Lave

  • 25516 posts


Users Awards

Posted 14 September 2012 - 11:39 AM

Less code is better code ^_^


Not necessarily.

#6 Sweeney

Sweeney
  • 1230 posts


Users Awards

Posted 14 September 2012 - 11:41 AM

Not necessarily.


Well, not if it stops working... :p

#7 Waser Lave

Waser Lave

  • 25516 posts


Users Awards

Posted 14 September 2012 - 11:43 AM

Well, not if it stops working... :p


Don't say it then. :p

#8 Guest_idonotexist_*

Guest_idonotexist_*

Posted 14 September 2012 - 11:43 AM

Awesome :) Thanks guys.

Much appreciated. At least I only made a small mistake


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users