Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Leda > Need help with ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 169 of 212
Post > Topic >>

Need help with this project....

by "jayfro" <jebefro85@[EMAIL PROTECTED] > Oct 23, 2004 at 09:17 PM

I haven't been to class in weeks...dont ask why
but i havent been able to figure out this project my professor gave me
someone help me out, i have it all done but the voterName wont except no
more than one character some one help me out

Purpose: (builds on Lab #3 Part #2) 

  

To write a program that will receive information about a voter, determine
the age of the voter, and print out (with formatting) the voters
information to the screen. 

Input: 

The voter information will be given as input information from the keyboard
(until we cover input files) 

  

Data structures to use: 

  

A simple class (struct) must be used (this is described below) along with
a minimum of 5 functions. Other possible data structures to be used,
depending on your logic are: if statements, switch statements, and loops,


  

Class definition 

  

This class will contain six public members: 

  

class Voter 

{ 

int voterId; // the voter id will be an integer between 100 and 10,0000-
input by user 

char voterName : // a string with no white space 

int voterBirthYear; // this will be input by the user (4 digit year
required) 

float voterAnnualIncome; //this will be input by the user 

char voterGender; //the letter F or M - this will be input by the user 

int currentAge; //current year minus birth year - calculated in the
program 

}; 

  

Input 
 Action 
 
voterid  A valid product idnumber will be an integer between 1000 and
10000. 

If an invalid idnumber is entered the programmer should re-ask the user
for a valid idnumber. 
 
  
   
 
voterName 
 A valid product name is a string no longer than 14 characters – the
string can contain no white space (this will come later). 

  
 
  
   
 
voterBirthYear 
 A valid entry would be a positive integer for 1900 – 2004 

  

If an invalid voterBirthYear is entered the programmer should re-ask the
user for a valid voterBirthYear value. 
 
  
   
 
voterAnnualIncome 
 A valid entry would be a positive float in the acceptable float range. 

If an invalid unitprice float is entered the programmer should re-ask the
user for a valid unitprice value. 
 
  
   
 
voterGender  This is a char - a valid entry is an M, m, F or f. 

  

If an invalid voterGender is entered, the programmer should re-ask the
user for a valid voterGende value. 
 
  
   
 
currentAge  This is a calculated field, not to be input by the user, 

The calculation will occur in the program and a message indicating if the
individual is old enough to vote or not printed. 
 

 

Input : Your program should prompt the user to enter: 

•  A voter id number – an integer in the range 1000< voterid <10000 

•  Voter name - a character string no longer than 14 characters in length
with no white spaces. 

•  Voter birth year – an integer- 1900 < voterBirthYear< 2004 

•  A float that represents the individuals annual income (any positive
float). 

•  A character for the voter's gender – M, m, F, f 

  

Processing : Your program will: 

•  Check the 4 numeric input values for accuracy. If out of range or
inaccurate, print an Error and ask the user to re-enter a new value. 

•  Calculate the age of the voter. 

  

Output : 

A report (formatted) containing the following data clearly listed and
formatted appropriately 

  

•  voter's ID number 

•  voter's name 

•  voter's year of birth 

•  voter's annual income 

•  voter's gender 

•  voter's age and message of right to vote or not to vote. 

  

Requirements : Your program must include the following 4 functions (more,
if you want). 

•  A purpose function explaining the input and notifying the voter of
election day. 

•  a function(one or more) to receive the voter information 

•  A function to calculate the voter's age. 

•  a function to print the voters information. 

Your program must exhibit good modular programming style. You will lose
points for poor indenting, poor variable names, lack of internal comments,
bad logic and other items that make a program difficult to read. 

Remember: A program that does not compile is worth 0 points. 

  

What to hand in: In a labeled folder place: 

•  A listing of the voter code (the cpp file) containing internal
documentation . 

•  A labeled disk with the program files (cpp, dsw and dsp) located in a
project 1 folder . Do not give me the only working copy of your project. 

•  Copies of output from at least three runs. 

•  A user manual – a document that explains to another person how to use
the executable version of your program. Make sure that it is clear to the
user what needs to be entered as correct input. See Documentation handout.


•  A programmer manual – a document that involves a careful stepwise
refinement (algorithm) for the program and each function along with a
structure chart. See documentation handout.




 1 Posts in Topic:
Need help with this project....
"jayfro" <je  2004-10-23 21:17:59 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 6:51:56 CDT 2008.