5 Replies - 488 Views - Last Post: 18 April 2019 - 09:56 AM Rate Topic: -----

#1 DoomDemolisher   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 14-March 19

Cooking Time Calculator

Posted 18 April 2019 - 08:53 AM

I am trying to create a program that asks which food someone wants to cook, the asks them how many pounds of that food they would like to cook at once. After this it is supposed to calculate the amount of time it would take to cook the food. I'm trying to get the program to show how ling it will take in hours and minutes, but when I try to divide the minutes by 60, it gives me a number like, 3.33333333 hours.

start:
Textwindow.Clear()
Textwindow.Write("Do you want to cook Beef, Chicken, Turkey, or Pork? ")
food = Textwindow.Read()

If food = "beef" Then
  Goto beef
  ElseIf food = "chicken" Then
    Goto chicken
    ElseIf food = "turkey" Then
  Goto turkey
  ElseIf food = "pork" Then
    Goto pork
    EndIf
    
    
    beef:
    Textwindow.Write("How many pounds of beef do you want to cook? ")
    beef = Textwindow.ReadNumber()
    Goto beefweight
    
    chicken:
    Textwindow.Write("How many pounds of chicken do you want to cook? ")
    chicken = Textwindow.ReadNumber()
    Goto chickenweight

    turkey:
    Textwindow.Write("How many pounds of turkey do you want to cook? ")
    turkey = Textwindow.ReadNumber()
    Goto turkeyweight
    
    pork:
    Textwindow.Write("How many pounds of pork do you want to cook? ")
    pork = Textwindow.ReadNumber()
    Goto porkweight
    
    beefweight:
    Textwindow.WriteLine("The current time is: " + Clock.Hour + ":" + Clock.Minute + ":" + Clock.Second + ".")
    weight = beef * 40
    time = weight / 60
    Goto beeftime
    
    chickenweight:
    Textwindow.WriteLine("The current time is: " + Clock.Hour + ":" + Clock.Minute + ":" + Clock.Second + ".")
    weight = chicken * 25
    time = weight / 60
    Goto chickentime
    
    turkeyweight:
    Textwindow.WriteLine("The current time is: " + Clock.Hour + ":" + Clock.Minute + ":" + Clock.Second + ".")
    weight = turkey * 30
    time = weight / 60
    Goto turkeytime
    
    
    porkweight:
    Textwindow.WriteLine("The current time is: " + Clock.Hour + ":" + Clock.Minute + ":" + Clock.Second + ".")
    weight = pork * 20
    time = weight / 60
    Goto porktime
    
    
    
    beeftime:
    Textwindow.WriteLine("You will need to cook your beef for " + time + " hours ")
    Textwindow.Write("Is this time ok? ")
    choice = Textwindow.Read()
    If choice = "yes" Then
      Program.End()
    ElseIf choice = "no" Then
      Goto start
      EndIf
    
    chickentime:
    Textwindow.WriteLine("You will need to cook your chicken for " + time + " hours ")
    Textwindow.Write("Is this time ok? ")
    choice = Textwindow.Read()
    If choice = "yes" Then
      Program.End()
    ElseIf choice = "no" Then
      Goto start
      EndIf

    turkeytime:
    Textwindow.WriteLine("You will need to cook your turkey for " + time + " hours ")
    Textwindow.Write("Is this time ok? ")
    choice = Textwindow.Read()
    If choice = "yes" Then
      Program.End()
    ElseIf choice = "no" Then
      Goto start
      EndIf

    porktime:
    Textwindow.WriteLine("You will need to cook your pork for " + time + " hours ")
    Textwindow.Write("Is this time ok? ")
    choice = Textwindow.Read()
    If choice = "yes" Then
      Program.End()
    ElseIf choice = "no" Then
      Goto start
    EndIf
    


Is This A Good Question/Topic? 0
  • +

Replies To: Cooking Time Calculator

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14995
  • View blog
  • Posts: 59,870
  • Joined: 12-June 08

Re: Cooking Time Calculator

Posted 18 April 2019 - 09:02 AM

You neglected to ask a question.
Was This Post Helpful? 0
  • +
  • -

#3 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2836
  • View blog
  • Posts: 11,132
  • Joined: 03-December 12

Re: Cooking Time Calculator

Posted 18 April 2019 - 09:26 AM

Goto beefweight

That is some of the nastiest code I have seen in a while.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14995
  • View blog
  • Posts: 59,870
  • Joined: 12-June 08

Re: Cooking Time Calculator

Posted 18 April 2019 - 09:33 AM

@astone - totes.. much worse than beefsquatch.

Posted Image
Was This Post Helpful? 0
  • +
  • -

#5 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2836
  • View blog
  • Posts: 11,132
  • Joined: 03-December 12

Re: Cooking Time Calculator

Posted 18 April 2019 - 09:52 AM

https://www.dreaminc...mply-explained/

https://www.dreaminc...dex-calculator/

https://www.dreaminc...ncerns-matters/

https://www.dreaminc...ns-subroutines/
Was This Post Helpful? 0
  • +
  • -

#6 DarenR   User is offline

  • D.I.C Lover

Reputation: 602
  • View blog
  • Posts: 3,993
  • Joined: 12-January 10

Re: Cooking Time Calculator

Posted 18 April 2019 - 09:56 AM

youre using clock items but not in the math?

all you are basically doing is simple math and expecting times to be outputted?
how is the program supposed to know you want datetime? (time)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1