CS 010 - Introduction to Computer Science I
Assignment 2:

DUE: Fri, January 21 before 7:00pm


Collaboration Policy

Collaboration is strongly ENCOURAGED. You can work in teams, but programs must represent YOUR OWN original work. Teams can work on the algorithm together and help debug/test each others code. However, copying code from ANY source (any book, current or past students, past solutions, the web, etc.) is STRICTLY FORBIDDEN.


Code that is turned in, must be contained in a .cpp file named main.cpp. Files of ANY other format will not be graded (e.g. main.doc, main.txt, etc…).

You must turn your work in using electronic turnin as in lab1, from a lab computer on campus, TURNING IN FROM HOME WILL NOT WORK!

Turn in online to as2 folder. If you turn your assignment in to the wrong folder, your assignment may not be graded. If it is graded, you will lose 2 pts (out of 10).

Remember to include the following header information at the top of your program;
// Course: CS 10
//
// Lecture Section: ... 001 or 002
// Lab Section: ... 021, 022, etc)
//
// Assignment #: ... assignment 2, 3, etc.
//
// Last Name: Enter your LAST (family) name here (eg, Doe)
// First Name: Enter your FIRST (given) name here (eg, John)
//
// ID Number: Enter your ID number here (eg, 860-00-0000)
// lab login id: Enter your cs10 login here (eg, jdoe)
//
// Email address: Enter your UCR email address here (eg, jdoe@cs.ucr.edu)
//
// Teammates: List the names of the teammates you worked with
//
// =======================================================================



Problem Definition:

For this assignment love is in the air.  You will write a program that takes as input exactly six different items; a groom's name, a bride's name, the length of the groom's last name, the length of the bride's first name, the groom's yearly income, and the bride's yearly income.  You must input the last and first name of the groom with a single cin statement (the same is true for the bride)!  Your program will then print out the bride's new name, which is traditionally the first name followed by the groom's last name.  The new name should be printed out nicely, with the bride's first name right alligned to the word "First" above it, followed by the new last name right alligned to the word "Last" above it (see the screen shots below).  Your program will then print out the newleywed's average yearly income, with a fixed decimal point, and two numbers to the right of the decimal point.

Hints:
-Input the names as a string using cin, but make sure there is no spaces between the comma, and the last and first name.
-You will need to use the length(), and substr() string member functions to extract the first, and last names.
-You will need to use setw() to right allign the bride's new name correctly as in the pictures below, and mentioned above.
-You will need to use setprecision(), and "fixed" to correctly print the average income.

Example program run 1:
example_pic_one

Example program run 2:
example_pic_two


Rubric: (10 pts total)

2 pt(s): Correctly extracts Bride's first name from a single variable
2 pt(s): Correctly extracts Groom's last name from a single variable
2 pt(s): Bride's new name is printed with correct alignment, in the same format as the examples above
2 pt(s): Average income is printed with a fixed decimal point, and two numbers to the right of the decimal point
1 pt(s): Average income is correct
1 pt(s): Style
- comments
- line wraps
- spacing
- Indentation
- Good constant/variable names
- No magic numbers

Note that you will lose points for style on this assignment!
For coding style requirements see the following link:
http://www.cs.ucr.edu/cs10/cs10_05win/requirements/coding_std.html