Announcement

Collapse
No announcement yet.

Help with Qbasic PLEASE!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with Qbasic PLEASE!

    You have been given an algorithm that will prompt a terminal operator for the price of an article and a pricing code. Your program is then to calculate a discount rate according to the pricing code and print to the screen the original price of the article, the discount amount and the new discounted price. Calculate the pricing code and accompanying discount amount as follows:
    Pricing code
    Discount rate
    H
    50%
    F
    40%
    T
    33%
    Q
    25%
    Z
    0%
    If the pricing code is Z, then the words ‘No discount’ are to be printed on the screen. If the pricing code is not H, F, T, Q or Z then the words ‘Invalid pricing code’ are to be printed.

    HERE IS THE PSEUDOCODE:
    B Solution algorithm
    Calculate_discounted_price
    1 Prompt for price, pricing_code
    2 Get price, pricing_code
    3 set message to blank
    4 set discount_amount, new_price to zero
    5 CASE OF pricing_code
    H : discount_amount = price * 0.5
    F : discount_amount = price * 0.4
    T : discount_amount = price * 0.33
    Q : discount_amount = price * 0.25
    Z : message = ‘No discount’
    other: message = ‘Invalid pricing code’
    ENDCASE
    6 IF message = blank THEN
    new_price = price - discount_amount
    Display price, discount_amount, new_price
    ELSE
    Display price, pricing_code, message
    ENDIF
    END

    I'm not sure if I start with DIM or what! PLEASE help!

  • #2
    nothing to do with my computer right turn Clyde



    Mydol/ Pamprin time

    Comment


    • #3
      a) this is an forum for people with spinal cord injuries

      and

      b) do your own homework.

      and

      c) Qbasic? What are you taking a class from 2000?

      Comment


      • #4
        Mr./Ms. negative / having a pity party for myself

        I'm done with the problem but it will not run. I don't know where my error is. This isn't homework and Qbasic is still used to develop applications. If you can't help be negative somewhere else and I'm sorry you have a spinal injury but I hope you cheer up. I posted in the Computer section and FYI people with spinal injuries use computers

        Comment


        • #5
          You do need to DIM your variables...

          Comment


          • #6
            Originally posted by Tray View Post
            I posted in the Computer section and FYI people with spinal injuries use computers
            I think you would get more answers in an actual computer programming forum. Like you were told, this is just a sub forum of a sci site.

            I guess it is like I were to ask for cookie recipes on a computer site? Yes, you eat cookies, but .....
            yes, you need to dim your variables first.

            It sure strikes me as an assignment. the way it was written is the way assignments are written, certainly not the way I was given a job as a programmer.

            So double shame for lying about it. Man up!
            T7-8 since Feb 2005

            Comment


            • #7
              pm me...i'll help if i can...

              Comment


              • #8
                This is the computers forum, but I can't help. Using BASIC or Microsoft is like going back to wearing nappies. Its just not right. I have real aversion. Is BASIC Turing complete? I.e. general purpose. I only remember being snookered by it every time I tried.

                I remember a bit of BusinessBASIC, but that is a dialect of FORTRAN for COBOL applications written by PASCAL programmers. Know about FORTRAN, LISP and C.
                http://zagam.net/

                Comment


                • #9
                  Originally posted by Tray View Post
                  I'm done with the problem but it will not run. I don't know where my error is. This isn't homework and Qbasic is still used to develop applications. If you can't help be negative somewhere else and I'm sorry you have a spinal injury but I hope you cheer up. I posted in the Computer section and FYI people with spinal injuries use computers
                  Lol, I just read this. No wonder you can't figure out such a simple programming problem, you are an idiot.

                  Comment


                  • #10
                    Originally posted by willingtocope View Post
                    You do need to DIM your variables...
                    Ah, So BASIC is a 3.5 GL! Auto some times, promote some times, work some times. You have to declare arrays in Bash too. I use full 4GLs like Unix shell and friends. Use it the same way I used to use LISP. See my Unix shell entry in http://en.wikipedia.org/wiki/Complem...ming_languages Unix shell is also the basis of some NoSQL with look, join, etc. Unix V7: Nothing new under the Sun or on the Sun.
                    http://zagam.net/

                    Comment


                    • #11
                      Originally posted by zagam View Post
                      This is the computers forum, but I can't help. Using BASIC or Microsoft is like going back to wearing nappies. Its just not right. I have real aversion. Is BASIC Turing complete? I.e. general purpose. I only remember being snookered by it every time I tried.

                      I remember a bit of BusinessBASIC, but that is a dialect of FORTRAN for COBOL applications written by PASCAL programmers. Know about FORTRAN, LISP and C.
                      I've been programming for 50 years. Basic in one form or another has been around that long...and continues to be used today. The system I maintain for a major company is web based with an ASP backend mostly written in VBScript...and talking to a collections of DLLs written in stndard VB.

                      Not saying Basic is my favorite (I can get things done faster in C), but, like Cobol..it ain't dead yet.

                      Comment

                      Working...
                      X