CS 180 Midterm1 Exam (100 pts Due March 2, 2015 by 9:00 am)
Direction:
A) You need to write two separate java code for the following problem. First code for problem 1 and the second code for problem 2.
B) You should have separate pseudocode(blue print) for problem 2.
C) Create a folder that has your name. Place all these three files into the folder. Zip it and submit through blackboard.
Problems:
I) (40 pts) Write a java program to read following information from keyboard and display as indicated.
First name
Last name
Middle initial
Address (may contain one or more words)
Phone number (in the form of area code-exchange number-number. Example 270-745-2244
Output these information as follows:
Name : Last name, First name MI.
Address: address
Phone : phone number
Grade: Successfully reading all parameters (20 pts)
Display output as indicated (20 pts)
II) (60 pts) A day in a year has day, month, and year parameters. For example today is February 25, 2015. A month can also be represented by an integer, where 1 is January, 2 is February, .., and 12 is December. These three integers day, month, and year can be converted the following string format: MM/DD/YYYY to represent a day. We are assuming that year is 4-digit, month is at most 2-digit and day is also at most 2-digit. If day or month has only one digit, then leading 0 must be added in the form MM/DD/YYYY. For example day 2, month is 3, and year is 2012(March 2, 2012) then representation of the day is:
03/02/2012
Write a java code that creates three days, day1,day2,day3 as indicated above and outputs the
following:
Day 1: 12/12/2004
Day 2: 12/11/2004
Day 3: 03/04/2005
Days from earliest to latest are: 12/11/2004 12/12/2004 03/04/2005
Grading: (30) creating day in MM/DD/YYYY form by reading three integers from keyboard
(20) Listing three days as indicated above
(10) Listing days from earliest to latest