Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program help please!
#1
I'm very new to programming and I'm taking a distance course for programming in QBaisc. I've been working on a program for school and I'm just having problems with it. I'm not asking for someone to write it but rather some direction. Below is the problem and a sample output. What I have done so far is under that and I'm just confused on many things and need some help understanding. I'm asking for help now because I've been stuck for awhile. The text is informative but maybe I'm missing something. I think I'm having trouble more or less with the formula. TIA!

SeeSpot


The Twelve Days of Christmas. Each year the Provident National Bank of Philadelphia publishes a Christmas price list (see table 4). Write a program that requests an integer from 1 to 12 and then lists the gifts for that day along with that day’s costs. On the nth day, the n gifts are 1 partridge in a pear tree, 2 turtledoves…n of the nth item. The program should also give the total cost of all twelve days. A sample output is as follows:

[run]
Enter a day from 1 to 12: 3
The gifts for day 3 are
1 partridge in a pear tree
2 turtledoves
3 French hens
Costs: $92.50
Total cost for the twelve days: $71,618.50

Table 4: Christmas Price Index (1992)

Item Cost (in dollars)
Partridge in a pear tree 27.50
Turtledove 25.00
French hen 15.00
Calling bird 70.00
Gold ring 60.00
Geese-a-laying 25.00
Swan-a-swimming 1000.00
Maid-a-milking 4.25
Lady dancing 289.50
Lord-a-leaping 292.50
Piper piping 95.75
Drummer drumming 95.00


Here is what I have so far:

REM The Twelve Days of Christmas
CLS
DIM gift$(1 TO 12), cost(1 TO 12)

FOR i = 1 TO 12
READ gift$(i), cost(i)
NEXT i

DO
INPUT "Enter a day from 1 to 12: ", num
SELECT CASE num
CASE 1
PRINT gift$(1)
CASE 2
CASE 3
CASE 4
CASE 5
CASE 6
CASE 7
CASE 8
CASE 9
CASE 10
CASE 11
CASE 12
CASE ELSE
PRINT "Please try again!"
END SELECT
LOOP UNTIL num <= 12

REM ---Data: gifts, costs
DATA Partridge in a pear tree, 27.50, Turtledove, 25.00
DATA French hen, 5.00, Calling bird, 70.00
DATA Gold ring, 60.00, Geese-a-laying, 25.00
DATA Swan-a-swimming, 1000.00, Maid-a-milking, 4.25
DATA Lady dancing, 289.50, Lord-a-leaping, 292.50
DATA Piper piping, 95.75, Drummer drumming, 95.00
END
Reply


Messages In This Thread
Program help please! - by SeeSpot - 03-01-2003, 01:11 AM
Program help please! - by pr0gger - 03-01-2003, 01:37 AM
Program help please! - by SeeSpot - 03-01-2003, 01:52 AM
Program help please! - by pr0gger - 03-01-2003, 02:08 AM
Program help please! - by SeeSpot - 03-01-2003, 10:32 AM
Program help please! - by toonski84 - 03-01-2003, 10:56 AM
Program help please! - by SeeSpot - 03-01-2003, 11:27 AM
Program help please! - by SeeSpot - 03-01-2003, 11:31 AM
Program help please! - by SeeSpot - 03-03-2003, 04:24 AM
Program help please! - by toonski84 - 03-03-2003, 04:51 AM
Program help please! - by SeeSpot - 03-03-2003, 05:06 AM
Program help please! - by toonski84 - 03-03-2003, 05:13 AM
Program help please! - by SeeSpot - 03-03-2003, 05:24 AM
Program help please! - by SeeSpot - 03-03-2003, 05:42 AM
Program help please! - by pr0gger - 03-03-2003, 05:58 AM
Program help please! - by SeeSpot - 03-03-2003, 06:29 AM
That's not a bug... - by Glenn - 03-03-2003, 08:22 AM
Program help please! - by SeeSpot - 03-03-2003, 10:52 AM
Program help please! - by toonski84 - 03-03-2003, 02:50 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)