QBASIC NEED HELP WITH HOMEWORK PLEASE

Need help with my homework please =\

  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »

49 Replies - 3700 Views - Last Post: 11 March 2008 - 02:37 PM Rate Topic: -----

#1 StealthTools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 52
  • Joined: 11-March 08

QBASIC NEED HELP WITH HOMEWORK PLEASE

Post icon  Posted 11 March 2008 - 12:19 PM

HI...

I need help with my QBasic homework

Here it is: Use QBasic to write a program that allows the user to enter the number of quarters, dimes, nickles, and pennies. The program should translate the coins into a dollar amount and display the result. Your program should include the following:

* A SUB procedure that recieves the number of each coin and translates the coins into a dollar amount.

* Appropriate comments, including your name, a brief summary of the program, and description for each set of statements.

* Descriptive variable names.

* Correct, formatted output.



If you can help me on this or even write a program for me that would be awesome!

I have to have it completed by 6:00pm 3/11/08

I am logged into Windows Live messenger now: Stealth_Tools@Hotmail.com

Thanks for your help...

Is This A Good Question/Topic? 0
  • +

Replies To: QBASIC NEED HELP WITH HOMEWORK PLEASE

#2 Nykc  Icon User is offline

  • Gentleman of Leisure
  • member icon

Reputation: 725
  • View blog
  • Posts: 8,638
  • Joined: 14-September 07

Re: QBASIC NEED HELP WITH HOMEWORK PLEASE

Posted 11 March 2008 - 12:27 PM

LMAO - They are still teaching QBasic.

I would be happy to do your homework for you, but I don't think you professor would approve of PLAGIARISM.

Oh and Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.


Instead post your :code: and we can maybe help you when you get stuck. List your errors and what it should be doing. We can work through this as a team.

Happy Coding!

This post has been edited by Nykc: 11 March 2008 - 12:28 PM

Was This Post Helpful? 0
  • +
  • -

#3 StealthTools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 52
  • Joined: 11-March 08

Re: QBASIC NEED HELP WITH HOMEWORK PLEASE

Posted 11 March 2008 - 12:28 PM

View PostNykc, on 11 Mar, 2008 - 12:27 PM, said:

LMAO - They are still teaching QBasic.

I would be happy to do your homework for you, but I don't think you professor would approve of PLAGIARISM.

Instead post your :code: and we can maybe help you when you get stuck. List your errors and what it should be doing. We can work through this as a team.

Happy Coding!



I don't have a professor.. I am home schooled and have a proctor... I have no clue how to do this and if I had the working code I could learn THIS PROGRAM and take my test and hopefully make a good grade on it... this program is to help me learn before my test

I can paste code I have done in the past but I have no idea on how to do SUB functions...

This post has been edited by StealthTools: 11 March 2008 - 12:30 PM

Was This Post Helpful? 0
  • +
  • -

#4 Nykc  Icon User is offline

  • Gentleman of Leisure
  • member icon

Reputation: 725
  • View blog
  • Posts: 8,638
  • Joined: 14-September 07

Re: QBASIC NEED HELP WITH HOMEWORK PLEASE

Posted 11 March 2008 - 12:33 PM

This should help you out in regards to SUBS and Functions.

SUBS and Functions
Was This Post Helpful? 0
  • +
  • -

#5 StealthTools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 52
  • Joined: 11-March 08

Re: QBASIC NEED HELP WITH HOMEWORK PLEASE

Posted 11 March 2008 - 12:37 PM

View PostNykc, on 11 Mar, 2008 - 12:33 PM, said:

This should help you out in regards to SUBS and Functions.

SUBS and Functions



If you would please stay with me on thsi post... I will try and create this program and post it on here,

thanks a bunch
Was This Post Helpful? 0
  • +
  • -

#6 Nykc  Icon User is offline

  • Gentleman of Leisure
  • member icon

Reputation: 725
  • View blog
  • Posts: 8,638
  • Joined: 14-September 07

Re: QBASIC NEED HELP WITH HOMEWORK PLEASE

Posted 11 March 2008 - 12:42 PM

Ill be around till 4:30 EST. I will do my best to help you

This post has been edited by Nykc: 11 March 2008 - 12:42 PM

Was This Post Helpful? 0
  • +
  • -

#7 StealthTools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 52
  • Joined: 11-March 08

Re: QBASIC NEED HELP WITH HOMEWORK PLEASE

Posted 11 March 2008 - 12:50 PM

View PostNykc, on 11 Mar, 2008 - 12:42 PM, said:

Ill be around till 4:30 EST. I will do my best to help you



I am EST also


Here's what I have so far:



DECLARE SUB GetData (Quarters, Dimes, Nickles, Pennies, Total)
DECLARE SUB DisplayInfo (Total)

'*** Coin translation ***
 
'*** This program requires the user to enter a  ***
'*** number of quarters, dimes, nickles, and	***
'*** pennies, Then converts that information to ***
'*** a dollar amount.						   ***

CLS

'*** CALL GetData to Prompt user to enter needed data ***

CALL GetData(Quarters, Dimes, Nickles, Pennies, Total)

'*** CALL DisplayInfo to display dollar amount ***

CALL DisplayInfo(Total)




SUB DisplayInfo (Total)


PRINT
PRINT
PRINT "You have:", Total; "dollars",
PRINT
PRINT
PRINT




END SUB

SUB GetData (Quarters, Dimes, Nickles, Pennies, Total)

CLS
PRINT
INPUT "Enter the number of quarters:", Quarters
INPUT "Enter the number of dimes:", Dimes
INPUT "Enter the number of nickles:", Nickles
INPUT "Enter the number of pennies:", Pennies
PRINT
LET Total = (Quarters * 25) + (Dimes * 10) + (Nickles * 5) + (Pennies)
PRINT












END SUB








Holey hell???

Is this correct?? I get the right amount of dollars I think!!!!!!

All it seems to need now is an easy format$

OMG!!
Was This Post Helpful? 0
  • +
  • -

#8 Nykc  Icon User is offline

  • Gentleman of Leisure
  • member icon

Reputation: 725
  • View blog
  • Posts: 8,638
  • Joined: 14-September 07

Re: QBASIC NEED HELP WITH HOMEWORK PLEASE

Posted 11 March 2008 - 12:52 PM

Looks ok, let me test it for you...

What are you compiling this in? I was trying with Just BASIC and it won't run because it doesnt like

SUB DisplayInfo (Total)

I am stepping through your code, it just looks like you will need to add the format$.

This post has been edited by Nykc: 11 March 2008 - 12:55 PM

Was This Post Helpful? 0
  • +
  • -

#9 StealthTools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 52
  • Joined: 11-March 08

Re: QBASIC NEED HELP WITH HOMEWORK PLEASE

Posted 11 March 2008 - 12:52 PM

View PostNykc, on 11 Mar, 2008 - 12:52 PM, said:

Looks ok, let me test it for you...


K! :)
Was This Post Helpful? 0
  • +
  • -

#10 StealthTools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 52
  • Joined: 11-March 08

Re: QBASIC NEED HELP WITH HOMEWORK PLEASE

Posted 11 March 2008 - 12:58 PM

View PostStealthTools, on 11 Mar, 2008 - 12:52 PM, said:

View PostNykc, on 11 Mar, 2008 - 12:52 PM, said:

Looks ok, let me test it for you...


K! :)



I am using QBASIC 7.1

And take a look at this?


DECLARE SUB GetData (Quarters, Dimes, Nickles, Pennies, Total)
DECLARE SUB DisplayInfo (Total)

'*** Coin translation ***
 
'*** This program requires the user to enter a  ***
'*** number of quarters, dimes, nickles, and	***
'*** pennies, Then converts that information to ***
'*** a dollar amount.						   ***

CLS

'*** CALL GetData to Prompt user to enter needed data ***

CALL GetData(Quarters, Dimes, Nickles, Pennies, Total)

'*** CALL DisplayInfo to display dollar amount ***

CALL DisplayInfo(Total)

SUB DisplayInfo (Total)


PRINT
PRINT
PRINT USING Format$; "You have:"; Total; "dollars";
PRINT
PRINT
PRINT




END SUB

SUB GetData (Quarters, Dimes, Nickles, Pennies, Total)

CLS
PRINT
INPUT "Enter the number of quarters: ", Quarters
INPUT "Enter the number of dimes: ", Dimes
INPUT "Enter the number of nickles: ", Nickles
INPUT "Enter the number of pennies: ", Pennies
PRINT
LET Format$ = "$$###.##"
PRINT
LET Total = (Quarters * 25) + (Dimes * 10) + (Nickles * 5) + (Pennies)
PRINT













END SUB









Why won't this Format$ work? the program runs fine and then gets an error before calling the total dollar amount.


EDIT: Oh yea, If you logg onto Windows Live messenger I can send you my version of QBASIC 7.1

This post has been edited by StealthTools: 11 March 2008 - 01:06 PM

Was This Post Helpful? 0
  • +
  • -

#11 Nykc  Icon User is offline

  • Gentleman of Leisure
  • member icon

Reputation: 725
  • View blog
  • Posts: 8,638
  • Joined: 14-September 07

Re: QBASIC NEED HELP WITH HOMEWORK PLEASE

Posted 11 March 2008 - 01:06 PM

Well without access to the program I can't install that version at work try this and let me know.

CLS
PRINT
Format$ = "$$###.##"
PRINT
PRINT USING Format$; Total
END



In place of Let Format$

This post has been edited by Nykc: 11 March 2008 - 01:07 PM

Was This Post Helpful? 0
  • +
  • -

#12 StealthTools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 52
  • Joined: 11-March 08

Re: QBASIC NEED HELP WITH HOMEWORK PLEASE

Posted 11 March 2008 - 01:09 PM

View PostNykc, on 11 Mar, 2008 - 01:06 PM, said:

Well without access to the program I can't install that version at work try this and let me know.

CLS
PRINT
Format$ = "$$###.##"
PRINT
PRINT USING Format$; Total
END



In place of Let Format$


I am getting like $202.00.., lol - not displaying as single dollar amounts..

Quarters: 5
Dimes: 3
Nickles: 8
Pennies: 7

Should = $2.02

How do I get this to display like that?

This post has been edited by StealthTools: 11 March 2008 - 01:15 PM

Was This Post Helpful? 0
  • +
  • -

#13 Nykc  Icon User is offline

  • Gentleman of Leisure
  • member icon

Reputation: 725
  • View blog
  • Posts: 8,638
  • Joined: 14-September 07

Re: QBASIC NEED HELP WITH HOMEWORK PLEASE

Posted 11 March 2008 - 01:10 PM

Ok well atleast we are getting somewhere lol. lets find out why

Ok one of two things then. Try adding decimals in front of the values. like Quarters * .25
see if that helps.

I think it is reading 5 as a whole number with the format.

This post has been edited by Nykc: 11 March 2008 - 01:12 PM

Was This Post Helpful? 0
  • +
  • -

#14 StealthTools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 52
  • Joined: 11-March 08

Re: QBASIC NEED HELP WITH HOMEWORK PLEASE

Posted 11 March 2008 - 01:17 PM

View PostNykc, on 11 Mar, 2008 - 01:10 PM, said:

Ok well atleast we are getting somewhere lol. lets find out why

Ok one of two things then. Try adding decimals in front of the values. like Quarters * .25
see if that helps.

I think it is reading 5 as a whole number with the format.


OK LETS SEE..


LET Total = (Quarters * .25) + (Dimes * .10) + (Nickles * .05) + (Pennies)

This above doesn't work...

Grrrrrrr..........

Without modifying: LET Total = (Quarters * 25) + (Dimes * 10) + (Nickles * 5) + (Pennies)
I get the right numbers it's just giving me $202.00 instead of $2.02

This post has been edited by StealthTools: 11 March 2008 - 01:24 PM

Was This Post Helpful? 0
  • +
  • -

#15 Nykc  Icon User is offline

  • Gentleman of Leisure
  • member icon

Reputation: 725
  • View blog
  • Posts: 8,638
  • Joined: 14-September 07

Re: QBASIC NEED HELP WITH HOMEWORK PLEASE

Posted 11 March 2008 - 01:26 PM

Ok plan B - lol (Sorry this would be easier if I had the ability to run this myself).

Numeric Format Characters - Rounding on Output

###	Digits appear, right-justified
.	Period
,	Comma if significance started
$	Dollar sign here
$$	Floating
**	Star fill
+	Sign appears
-	- if negative, blank if not
B	blank appears
_	Following character appears as is


This post has been edited by Nykc: 11 March 2008 - 01:27 PM

Was This Post Helpful? 0
  • +
  • -

  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »