Tuesday, October 15, 2019

Solution to Algorithm 2 Test #2

'the student council is selling tickets to the dance as follows'
'Junior Dance - $5.00'
'Senior Dance - At door - $15.00  - Advance -$10.00'
'students need an ID for Senior Dance'
'Determine and output the total for a student purchasing ticket(s)'

'This algorithm is written as the solution for algorithm #2 on Test 2'

jd = 5      'jd represents junior dance fee'
sda = 10  'sda represents senior dance fee advanced purchase'
sdd = 15  'sdd represents senior dance fee at the door'

print "Enter 1 for Junior dance ticket purchase"
print "Enter 2 for Senior dance ticekt purchase"
print "Enter 3 for combination purchases"
input num

if (num = 1) then
   print "enter the number of junior tickets needed"
   input jnum
   total = jnum * jd
   print "Your total is $", total
end if

if (num = 2) then
   print "Enter 1 for advanced purchase or 2 for tickets to pay for at the door"
   input ans
   if (ans = 1) then
      print "enter the number of senior tickets needed"
      input snum
      total = snum * sda
      print "Your total is $", total
  else
      if (ans = 2) then
         print "enter the number of senior tickets you want to reserve"
         input snum2
         total = snum2 * sdd
         print "We are reserving your tickets and you may pick up at the door upon payment."
         print "Your total will be $", total
      end if
   end if
end if

if (num = 3 ) then
   print "enter the number of junior tickets needed"
   input jnum
   jtotal = jnum * jd
 
   print "Enter 1 for advanced purchase or 2 for tickets to pay for at the door"
   input ans
   if (ans = 1) then
      print "enter the number of senior tickets needed"
      input snum
      stotal = snum * sda
   else
      if (ans = 2) then
         print "enter the number of senior tickets you want to reserve"
         input snum2
         sdtotal = snum2 * sdd
         print "We are reserving your tickets and you may pick up at the door upon payment."
      end if
   end if
   total = jtotal + stotal + sdtotal
   total2 = jtotal + stotal
   print "Your overalltotal is $", total
   print total2 , " is due now and ", sdtotal,"is due at the door"
end if

Print "Thank you for supporting the Student Council"
input key
 

2 comments:

  1. 'This algorithm is done by Brianna Tejada 16/10/2019'
    'The robotic team has created a robot to collect pollutants at the end of the day the robot places all the trash in a bin, the human worker seperates the trash into re-used or recycle write a program that determines and states how many peices of trash is for re-usuing and how many is for recycling, the bin holds 1000 peices.
    reu=0
    rec=0
    for x=1 to 3
    Print"enter how many pieces of recycle"
    input num1
    print"Enter how many pieces of re-use"
    input num2
    if (num1<reu) then
    reu=reu+1
    else
    if (num2<rec) then
    rec=rec+1
    end if
    end if
    next
    print" Amount of reuse",reu
    print"Amount of recycles",rec
    input key

    ReplyDelete
  2. 'This algorithm is done by Brianna Tejada 16/10/2019'
    'The robotic team has created a robot to collect pollutants at the end of the day the robot places all the trash in a bin, the human worker seperates the trash into re-used or recycle write a program that determines and states how many peices of trash is for re-usuing and how many is for recycling, the bin holds 1000 peices.
    reu=0
    rec=0
    for x=1 to 3
    Print"enter how many pieces of recycle"
    input num1
    print"Enter how many pieces of re-use"
    input num2
    if (num1<reu) then
    reu=reu+1
    else
    if (num2<rec) then
    rec=rec+1
    end if
    end if
    next
    print" Amount of reuse",reu
    print"Amount of recycles",rec
    input key

    ReplyDelete