Source: Mr. Sanford, BCC CIS73333.doc Lab Assignment 3 Due 10-05-09 Object Oriented Java Programming This week we are going to write one executable application program that we will use to research how to write arithmetic expressions to solve common problems and process String objects. In the first part of the program file we will not be taking any data from the keyboard, but in the last part of the program file, we will be taking all of the data in from the keyboard using an object of the Scanner class Note that all output should contain titles. Write one executable Java application program that will execute the following steps in sequence: 1. Declare two double variables. Declare and initialize four integer variables. Assign values to the two double vars in a separate statement. Write an arithmetic expression that uses the six vars and all four arithmetic ops. Assign the value of the arithmetic expression to a variable which has been declared as a double. Display the values of the six variables. Display the variable that holds the value of the arithmetic expression. 2. Declare four String objects and initialize them with cities in Alabama. Display the four Strings. Concatenate the four strings into a fifth String and display the fifth String. Append the Alabama postal state abbreviation to each of the first four Strings with a comma after the city and display the four appended Strings. 3. Declare variables to hold the following data fields: Company Name, Street Number, Street, City, State, Zip Code, Name of President or CEO, Phone Number and email Address. Note that vars holding Street Number and Zip Code should be int fields. Take in all data from the keyboard in the sequence above. Remember to use “prompts” and note that no multiple line entries are allowed. Display the vars in a logical format with several lines and possibly with multiple vars on some lines. Display a blank line between each line. The program file should count the number lines printed as each line prints and display the total number of lines printed at the end of the display. ********************************************************************************************************************************* Notes: 1. Label the end of all classes, methods, and blocks with a comment. 2. Line up the beginning brace { and ending brace } vertically for each block. (i.e. for each class, method, and block) 3. Indent all code between the beginning and ending braces so that the lineup of braces can be easily observed. 4. Include comments at the beginning of every .java source file with the assignment number, author, date due, and an essay (with paragraphs) at the start of the file describing the functionality of each class as well as how each class “works”. User instructions should also be provided. Are there comments reference important or complex syntax? 5. Insert dividers/separators (i.e. a line of dashes or a line of asterisks) between each method and class. 6. Capture your test results and paste them into the end of your .java source class file as comments. 7. Submit an electronic copy of your .java source class files (with the test results “pasted in” as comments) for credit. Note that all submissions should be made as attachments to an email, and sent to the instructor with the following subject line: CIS73 Lab x where x = the lab assignment number. Note that the subject line is case sensitive. 8. Note that assignments should be submitted on or before the due date for full credit per the course policies. 9. Note once again that all duplicate .java files that are submitted for a grade will NOT be graded. 10. To avoid problems with the weekly lab you should: a. Make a cursory read of the assigned material before class. At least you will know what is coming up! b. Attend the class lecture and ask questions as to whatever is not clear to you. c. Using the weekly study guide ………. Read and research the material as outlined in the study guide. It is the important stuff! Get back to me via email if you have any question. d. Next you should read and understand the requirements of the lab for this week. Again check with me in the lab or get back to me via email if you have any question. e. Write a solution for the programming assignment in English, pseudo English, Portuguese, Italian, Slang , Pseudo Java, or a graphic language. Do you understand exactly how this program is going to “work” and can you document it in some language that you understand? Do you understand all of the algorithms and mathematics involved? f. Translate your solution to Java. g. Write, compile, and continue to execute (test) your program file until it “works” as you planned. h. If you encounter a problem that you and your classmates cannot resolve, then get back to me via email or make an appointment with a tutor or with the instructor. We care about the students that care! i. Note that there is no substitution for adequate preparation.