Jump to content

Set ryanw327 = "CoolNewguy"

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
Ryanw327

Ryanw327

    Newbie

  • Members
  • PipPip
  • 13 posts
Hello codecall forums,

My name is Ryan I'm a student studying programming in Portsmouth NH @ greatbay.edu I don't really know much about programming currently. I am enrolled in a class called Programming logic, we have just started with the basics making pseudocode programs. I think this class will touch on java in a few weeks.

Hope to get to know everyone here.

Thanks.

Question: Can you display data as a mathematical expression?

a=1 b=2
Display "the answer is", a+b "."

in theory would this display 3?

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Welcome aboard, and yes, it would display 3 :)
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Ryanw327

Ryanw327

    Newbie

  • Members
  • PipPip
  • 13 posts
Thanks wp,

So we had to write this pseudo program that asked a user about car expenses. Here is what I came up with. I'm really enjoying this class, but I can't wait to get into some real programing.


Module main ()
//Declare variables
Declare real loanPayment, insurancePayment, gasPayment, oilPayment, tirePayment, maintenancePayment
//Set or Assign 
Declare string Lp, Ip, Gp, Op, Tp, Mp
Lp = “Loan” 
Ip = “Insurance”
Gp = “Gas”
Op = “Oil”
Tp = “Tires”
Mp = “Maintenance”
loanPayment=0
insurancePayment=0
gasPayment=0
oilPayment=0
tirePayment=0
maintenancePayment=0

//Call Modules
Call getMonthlyPayments(loanPayment, Lp)
Call getMonthlyPayments(insurancePayment, Ip)
Call getMonthlyPayments(gasPayment, Gp)
Call getMonthlyPayments(oilPayment, Op)
Call getMonthlyPayments(tirePayment, Tp)
Call getMonthlyPayments(maintenancePayment, Mp)
Call calcyearly(loanPayment, insurancePayment, gasPayment, oilPayment, tirePayment, maintenancePayment)
End Module // end of main
//Start modules
getMonthlyPayments(Real ref amount, string paystring)
	Display “Enter the monthly cost of your”, paystring 
	input amount
end Module 
calcyearly(Real ref a, b, c, d, e, f)
	Display “the total monthly cost of all expenses is”, a+b+c+d+e+f
	Display “the total yearly cost of all expenses is”, (a+b+c+d+e+f)*12
end Module