Need help on homwork assignment.

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2009
Posts: 14
Reputation: GooeyG is an unknown quantity at this point 
Solved Threads: 0
GooeyG's Avatar
GooeyG GooeyG is offline Offline
Newbie Poster

Need help on homwork assignment.

 
0
  #1
Jul 3rd, 2009
I need to create two enumerations, one for the months in the year and the other for birthstones.

Make a function named getBirthStone that returns the birthstone based on the month.
Jan-garnet
Feb-amethyst
Mar-aquamarine
Apr-diamond
May-emerald
June-pearl
July-ruby
Aug-peridot
Sep-sapphire
Oct-opal
Nov-topaz
Dec-turquoise

Add code to call the function when the user selects the display information option.

Include a menu item to the main menu to display all birth stones. Add code to call getBirthstone for each month.

I have started the assignment, but I'm not quite sure what I'm doing wrong. Any help is highly appreciated!!
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. Bstone::Bstone ( string ); // consructor intializes Bstone with string supplied as argument
  8.  
  9. int main()
  10. {
  11. int name; //the user's name
  12. int Bday; //the user's birthday
  13.  
  14. //prompting the user for their name
  15. cout << "Please enter your name:\n ";
  16. cin >> name;
  17.  
  18. //prompting user for their birthday
  19. cout << "Please enter your birthday:\n ";
  20. cin >> Bday;
  21.  
  22. //prompting the user to select one of the following.
  23. cout << "Please select the following, which you want to display:\n ";
  24.  
  25. //beginning of the switch statement.
  26. switch (Useroptions)
  27. {
  28. case 1: //displaying the user's birthstone.
  29. cout << "Here is " << name << " birthstone \n";
  30. cout << "His birthday is " << Bday;
  31. break;
  32. case 2: //displaying the user's astrogical sign.
  33. cout << name << " astrogical sign is " << ....;
  34. break;
  35. case 3: //displaying the season of which the user's birthday occurs in.
  36. cout << " The season in which " << name << " birthday occurs " << "....";
  37. break;
  38. default;
  39. }
  40.  
  41. char Months, BirthStone; // Months and Birthstones of the potential users
  42.  
  43. // enumeration declaration for months
  44. enum Months { Jan = 1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC };
  45.  
  46. // enumeration declaration for birthstones
  47. enum BirthStone { GARNET = 1, AMETHYST, AQUAMARINE, DIAMOND, EMERALD, PERAL, RUBY, PERIDOT, SAPPHIRE, OPAL, TOPAZ, TURQUOISE };
  48.  
  49. string Bstone::getBirthStone()
  50. {
  51. return Birthstone;
  52. } //end function getbirthstone
  53.  
  54.  
  55. return 0;
  56. }
Last edited by Ancient Dragon; Jul 3rd, 2009 at 11:56 pm. Reason: add code tags
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 117
Reputation: u8sand is on a distinguished road 
Solved Threads: 15
u8sand's Avatar
u8sand u8sand is offline Offline
Junior Poster

Re: Need help on homwork assignment.

 
-1
  #2
Jul 3rd, 2009
First of all, please surround your code with code tags or it makes it very hard for us to read. Second I would do this with array's, it seems it would make more sense, but this is an assignment.. Last, i would help you but you didn't do really anything just made a base and doesn't show me that you tried much.
I would love to help you but not enough effort was put into what you have so far.

You are not doing anything wrong, you just did not do anything accept for get it ready to be coded...
Last edited by u8sand; Jul 3rd, 2009 at 10:21 pm.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 476
Reputation: csurfer is just really nice csurfer is just really nice csurfer is just really nice csurfer is just really nice csurfer is just really nice 
Solved Threads: 76
csurfer's Avatar
csurfer csurfer is offline Offline
Posting Pro in Training

Re: Need help on homwork assignment.

 
0
  #3
Jul 3rd, 2009
You are not doing anything wrong, you just did not do anything accept for get it ready to be coded...
@u8sand : I really think you need to look at the code first and then give your comments.I found all the mistakes listed below.And you didn't find even one ??? Which compiler do you use by the way ? The one which corrects errors on its own ???

@GooeyG:

Lots of mistakes as such :

1>Where is Bstone class defined...???

2>
  1. switch(Useroptions)
Where are you asking the user for options???

3>
  1. default; //Default with a semicolon ???

4>Class member function defined within main ???

5>Enumeration within main ???

6>Name and Bdate that too integer ???

And many others...So correct them first.
Last edited by csurfer; Jul 3rd, 2009 at 11:52 pm.
I Surf in "C"....
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,812
Reputation: ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all 
Solved Threads: 117
ithelp's Avatar
ithelp ithelp is offline Offline
Posting Virtuoso

Re: Need help on homwork assignment.

 
0
  #4
Jul 4th, 2009
Where are you instantiating your class ? main should just have that , move the rest of code in another file say birthstone.c/birthstone.h .
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC