Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Basic programming question?

Write a program in BASIC that computes and displays a 15% tip where the price of a meal is input by the user.

(I'm a just a newbie and I *think* I understand but, was hoping someone would make sure I'm heading in the right direction...so here is what I have figured...) I know this really isn't so much a question but can someone throw me a bone?

Declare MealPrice, Tip As Real

Write "Enter your meal price."

Input MealPrice

Set Tip = MealPrice * .15

Write "The calculated tip for your meal is: ", Tip

Update:

Thanks- I am only using the words that my book uses...so that's where the "write" and "set" are coming from.

Thanks for your help!!!

2 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    that doesn't really look like BASIC to me. i'd say:

    DECLARE MealPrice, Tip as Real

    DISPLAY "Enter your meal price."

    INPUT MealPrice

    Tip = MealPrice * .15

    DISPLAY "The calculated tip for your meal is: ", Tip

    hope it helps

  • 1 decade ago

    That sure doesn't look like BASIC!

    Here is the BASIC program:

    10 INPUT "Enter meal price "; MEAL$

    20 TIP$ = MEAL$ * 0.15

    20 PRINT "TIP IS "; TIP$

Still have questions? Get your answers by asking now.