ST1/ST1(G) – Semester 1 2015
Java Programming Assignment
Object Oriented Programming with Java
Due Date: Week 12 Friday 11.30 pm
Get Assignment help for this assignment at [email protected]
This assignment is worth 40% of final mark for this unit
Submission and Assessment requirements:
This assignment will be marked out of 40 marks and carries 40% mark of the overall mark for the unit. Please check the unit outline for late penalties and resubmissions. This assignment is individual assignment.
For details of marking/grading for this assignment, please refer the marking guide available separately.
All submissions need to be electronic submissions through Moodle before the due date. Submission should be one single zip file (A1StudentIDLastName.zip) with Eclipse Project/Java source files for all parts, and a short report (word/pdf document).
1. The demonstration of each assignment question to the tutor in tutorial/computer labs in week 11/12 is recommended for each question of this assignment to get a feedback on your work.
2. The requirements for some programming problems are specified clearly, and for some, they are not specified clearly, and the requirements are somewhat vague. This has been done intentionally to make it more challenging, and it is expected that you come up with appropriate design strategy for solving these problems. You may want to refer to the lab activities in the tutorial classes for guidance on how to attempt each question.
3. General requirements for each program or class submitted are to have a header or block of comments at the top. The comments should contain your name, question number, part and the date. Here is an example:
John Smith (u123456)& Mary Joe (u543217)
4. All the programs should include sufficient evidence of testing in terms of test plan and screen shots and dumps with several test cases (at least 3 test cases).
Part 1: (20 marks) Thematic programming activities on OOP concepts
The objective of this part of assignment is to demonstrate the learning of core Java language features.
Q.1: (3 marks) Java Language Basics
Employee Pay Cheque Calculator : You have to design and implement a Java based software program for Employee pay cheque calculations, that can calculate and prints the monthly pay cheque for an employee.
The net pay of an employee is calculated after taking the following deductions:
Federal Income Tax: 15%
State Tax: 3.5%
Social Security Tax: 5.75%
Medicare/Medicaid Tax: 2.75%
Pension Plan: 5%
Health Insurance: $75.00
Your java software program should prompt the user to input the gross amount and the employee name. The output need to be displayed on a dialog box with output formatted to have two decimal places. A sample output test case is as follows:
Gross Amount: $ 3575.00
Federal Tax: $ 536.25
State Tax: $ 125.13
Social Security Tax: $ 205.56
Medicare/Medicaid Tax: $ 98.31
Pension Plan: $ 178.75
Health Insurance: $ 75.00
Net Pay: $ 2356.00
Q.2: (3 marks): Problem Solving with Java Arithmetic/logic statements
Sales Commission Calculator: A large company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who sells $5,000 worth of merchandise in a week receives $200 plus 9% of $5,000, or a total of $650. You’ve been supplied with a list of items sold by each salesperson. The values of these items are as follows:
Develop a Java console application, that inputs one salesperson’s items sold for last week and calculates and displays that salesperson’s earnings. There is no limit to the number of items that can be sold by a
salesperson. The test run of this application should produce the output shown below:
Q.3 (3 marks): Decision Making with Java
Award Points Calculator: Serendipity Booksellers has a book club that awards points to the customers based on the number of books purchased each month. The points are awarded as follows:
• If a customer purchases 0 books, he or she earns 0 points.
• If a customer purchases 1 book, he or she earns 5 points.
• If a customer purchases 2 books, he or she earns 15 points.
• If a customer purchases 3 books, he or she earns 30 points
• If a customer purchases 4 or more books, he or she earns 60 points
Create a Java GUI application that lets the user enter the number of books that he or she has purchased this month and displays the number of points awarded.
Q.4: (3 marks): Writing User Defined Methods in Java
Hospital Charges Calculator:
Create a Java (Console or GUI) application that calculates the total cost of the hospital stay. The daily base charge is $350. The hospital also charges for medication, surgical fees, lab fees, and physical rehab. The application should accept the following input:
• The number of days spent in the hospital
• The amount of medication charges
• The amount of surgical charges
• The amount of lab fees
• The amount of physical rehabilitation charges
Create and use the following value returning methods in the application
• CalcStayCharges – Calculates and returns the base charges for the hospital stay This is computed as $350 times the number of days in the hospital.
• CalcMiscCharges – Calculates and returns the total of the medication, surgical, lab, and physical rehabilitation charges.
• CalcTotalCharges – Calculates and returns the total charges.
Q.5: (3 marks): File I/O in Java
Haberman’s Survival Detector:
The UC Irvine Machine Learning repository contains many datasets for conducting computer science research. One such dataset is the Haberman’s Survival dataset, available at http://archive.ics.uci.edu/ml/datasets/Haberman’s+Survival . The file “haberman.data” contains survival data for breast cancer patients in comma-separated value format. The first field is the patient’s age at the time of surgery, the second field is the year of the surgery, the third field is the number of positive axillary nodes detected, and the fourth field is the survival status. The survival status is 1 if the patient survived 5 years or longer and 2 if the patient died within 5 years.
Write a Java Console or GUI based application program that reads the CSV file and calculates the average number of positive axillary nodes detected for patients that survived 5 years or longer, and the average number of positive axillary nodes detected for patients that died within 5 years. A significant difference between the two averages suggests whether or not the number of positive axillary nodes detected can be used to predict survival time. Your program should ignore the age and year fields for each record.
Q.6: (5 marks): Buiilding Java Applications
Math Quiz Game for kids:
Develop a Java application for a Math Quiz Game for school kids. You quiz game generates random addition problems. Provide some kind of feedback and scoring system as the problems are answered. The GUI should be somewhat similar to the following screenshot.
Part 2: Model View Design Pattern for Object Oriented Programming (12 marks)
The objective of this part of assignment is to demonstrate the advanced concepts in object oriented Java programming in terms of design patterns, inheritance and polymorphism
Community Sport Information Software Development
The context for this problem is managing Community Sport data, called Competitor Management System. The classes for this system used could be related as shown in the following Class diagram:
In this application, each competitor has an event (swimming, athletics) and a best performance (time / distance / etc) in
that event. (In the event field, S = “Swimming”, “A” = “Athletics”).
The file “competitors.txt” contains competitor name, id, event and best performance
(time/distance/etc), as shown here (The jpeg images are provided in a separate folder):
All parts of the question use the following graphical user interface:
1. (2.5 marks) Write the code for Competitor class as the abstract class with Swimmer and Athlete as two subclasses in an inheritance hierarchy.
2. (2.5 marks) Write the code for CompetitorList Class which contains an Array of Objects or an ArrayList of Competitor/Swimmer/Athlete objects in them.
3. (2 marks) Write the code for CompetitorFileReader class to read the file “competitors.txt” (which includes swimmers and athletes) and store the data in the array of objects or ArrayList.
4. (2.5 marks) When a competitor is selected in the list box, and “List Competitor Details” button is pressed, the competitor (Swimmer or Athlete) details including the photo, the event and the performance are displayed. Write the code to put the competitor’s details into the text area shown in GUI.
5. (2.5 marks) Improve the user interface by including some additional buttons for listing Swimmer and Athlete details separately, as well as best performing swimmer or athlete.
Part 3: Mobile App Development using Android Studio [8 marks]
• The lab challenge Activities in each week tutorial/lab work (week 2 to week 11) will help you in working on this part of the assignment.
• In this part of the assignment, you will design and develop a mobile app in Android Studio, demonstrating the understanding of Object Oriented Java Programming Constructs and Android Studio features you have learnt in weekly lab activities.
• You are free to choose any app which includes above Java programming constructs. Some of the lab challenge activities in each week can give you some ideas on the type of app you like to build.
Get Assignment help for this assignment at [email protected]