当前位置:天才代写 > JAVA代写,java代考-JAVA作业代写免费Moss检测 > java array代写 AACS2204 OBJECT-ORIENTED PROGRAMMING

java array代写 AACS2204 OBJECT-ORIENTED PROGRAMMING

2019-08-20 22:15 星期二 所属: JAVA代写,java代考-JAVA作业代写免费Moss检测 浏览:2192

java array代写 This is a group assignment. Students are to work in teams of maximum 3-4 members to create an object-oriented program for the given scenario.

AACS2204 OBJECT-ORIENTED PROGRAMMING TECHNIQUES ASSIGNMENT

NTRODUCTION

 This is a group assignment. Students are to work in teams of maximum 3-4 members to create an object-oriented program for the given scenario.

ASSIGNMENT SPECIFICATION

Learning Outcomes Being Assessed
 

CLO 2: Demonstrate an object-oriented program using appropriate programming fundamentals with regards to arrays, methods and exception handling. (P, P4)

 

CLO 3: Illustrate the concepts of encapsulation, inheritance and polymorphism to solve a given programming problem. (CTPS, C4)

Submission Deadline
 

Friday, 16 August 2019 (Week 12) by 4.00p.m.

 

Late submission

i) Within 1 – 3 days: total marks to be deducted is 10 marks.

ii) Late submission within 4 – 7 days: total marks to be deducted is 20 marks.

iii) Late submission after 7 days: reject coursework and zero mark shall be awarded.

 

Please refer to TAR UC guideline on late submission of coursework for more detail. (https://drive.google.com/open?id=0B- gN5U2qCJ9dc1N4dVhCOUpIdjY1QTBraWg5bS1xYTY5UFdB)

Overview
Point of Sale (POS) System
Description
Student team is required to innovate a point of sale software solution for business problems with object-oriented programming (OOP) approach in Java programming language. However, student team only need to develop simulated environment where output can be a console output of characters or graphical user interface (GUI). However, both display methods are acceptable without any marks discrimination. The term simulated environment is referring to software simulation instead of actual full implementation with real money transaction. For example, you only required to show virtual money account transfer without actual bank transfer to the bank account.

It is important to note that all student team’s ideas must be different and unique from other student teams. You can innovate point of sale system in different industry. E.g. food and beverage industry, retailer industry and etc. Your application is represented as Java objects in your system. You need to define the classes for these objects with advanced object-oriented programming    features    such    as    polymorphism,    inheritance    and

encapsulation to control and manage the objects in your system. Also, you

 

 

are encouraged to use Java’s interface to establish weak relationship between objects in your system. You must provide reporting feature of your system for your users to monitor the status of your system.

Do not use copyrighted images for your display if you are going for GUI display. You can create your own images or use public available licensed (e.g. creative common images) images with proper citation of the original source of the image.

 

Assignment scopes:

– The sales transaction must include customer / member information and sales person information

– The system must include the membership privilege (e.g: point collection for e-voucher / discount)

– The system should include stock quantity tracking, stock-in and stock-out, stock return from customer

– Reporting:

– Reporting:

o Daily / monthly sales report

o Transaction report based on sales person

o Transaction report based on member

o Point collection / discount privilege report based on member / membership level

o Product stock level report

Deliverables
The following items are to be handed in:

(a) UML class diagram that depicts the entity classes and their relationships.

 

(b) Cover page. Indicate the percentage contribution of each member.

 

(c) Description of your team’s assignment idea. Please provide sample screen shots and reports/listings. Printing of source code is NOT required but you need to include your Java project source code in the softcopy submission.

(d) Softcopy of source code –

· Include ALL your source code files and all pre-compiled classes.

· Form of submission –

o Each group creates a folder named using the format TutorialGroup-StudentFullNamesWithAlphabeticalOrder (e.g., RSF1(S2)-CatTanLiMei-HengTzeSeong-NgSiewYongAlice), and to be attached together with the report.

IMPORTANT: Work on the entity classes should be equally distributed between the team members. Likewise for the client program and report/listing.

 

NOTE: Submitting the assignment means you have agreed that your work is original and comply with the rules and regulations (refer to Academic Impropriety)

 

Paper Size / Format
 

Paper size A4 (Use only one side of the paper)

Estimated Time Required
At least 10 hours per team member.
Academic Impropriety
You may only work with the students in your team to produce your deliverables for this assignment.

This covers cheating, attempts to cheat, plagiarism, collusion and any other attempts to gain an unfair advantage in assessment.

The work that you submit must conform to those regulations.

Assessment
This assignment contributes 40 marks to your coursework. The allocation of marks is shown below. Refer to the Assignment Feedback Form for  the detail assessment criteria.

 

 

 

 

 

 

 

 

 

 

 

Marks for a team member = Total marks x % contribution

Note: if it is an individual assignment, the total marks will not be multiplied by the % contribution.

/** java code
* @(#)Address.java
*
*
* @author 
* @version 1.00 2019/7/28
*/


public class Address {
private String streetAddress;
private int postcode;
private String city;
private String state;
private String country;



public Address() {

}

public Address(String streetAddress,int postcode,String city,String state,String country){
this.streetAddress = streetAddress;
this.postcode = postcode;
this .city = city;
this.state = state;
this.country = country;

}

//setter
public void setStreetAddress(String streetAddress)
{
this.streetAddress = streetAddress;
}
public void setPostcode(int postcode)
{
this.postcode = postcode; 
}
public void setCity(String city)
{
this .city = city;
}
public void setState(String state)
{
this.state = state;
}
public void setCountry(String country)
{
this.country = country;
}
//getter
public String getStreetAddress()
{
return streetAddress;
}
public int getPostcode()
{
return postcode;
}
public String getCity()
{
return city;
}
public String getState()
{
return state;
}
public String getCountry()
{
return country;
}

public String toString()
{
return String.format("%s, %d, %s, %s, %s",streetAddress,postcode,city,state,country);
} 


}
/**
* @(#)Member.java
*
*
* @author 
* @version 1.00 2019/8/1
*/


public class Member extends Person{
private String memberID;
private int point = 0;
private double credit = 0;
private double mDiscount = 0;
private static int lastMemberID = 0;

public Member() {

if(lastMemberID < 10)
{
memberID = "M00" + lastMemberID;
}
else if(lastMemberID > 10 && lastMemberID < 100)
{
memberID = "M0" + lastMemberID;
}
else
memberID = "M" + lastMemberID++;

mDiscount = 0.1;

lastMemberID++;
}

public Member(Name name,String iC,String phoneNo,Address address) {
super(name,iC,phoneNo,address);

if(lastMemberID < 10)
{
memberID = "M00" + lastMemberID;
}
else if(lastMemberID > 10 && lastMemberID < 100)
{
memberID = "M0" + lastMemberID;
}
else
memberID = "M" + lastMemberID++;

mDiscount = 0.1;

lastMemberID++;
}

//get
public String getMemberID(){
return memberID;
}

//credit
public void addCredit(double topUpValue)
{
credit += topUpValue;
}

public double getCredit(){
return credit;
}

public void setCredit(double credit)
{
this.credit = credit;
}

//point
public int getPoint(){
return point;
}

public void addPoint(double amount,int cardBonus){
point += (int)(amount * 0.1) + cardBonus;
}

public int gainPoint(double amount,int cardBonus){
return (int)(amount * 0.1) + cardBonus;
}

public void setPoint(int point)
{
this.point = point;
}

//discount
public double getMemberDiscountRate()
{
return mDiscount;
}

public String toString(){
return String.format("MemberID:%s\n%sCredit:RM%.2f\nPoint:%d\n",memberID,super.toString(),credit,point);
}
}
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Scanner;

public class Membership {
private ArrayList<Member> memberList;

public Membership() {
memberList = new ArrayList<>();
}

/**
* Add new member
*
* @param member member
*/
public void addMember(Member member) {
// member has exists
if (search(member.getMemberID()) != null) {
System.out.println("This member has exists.");
} else {
memberList.add(member);
}
}

/**
* Edit member details
*
* @param member member
*/
public void updateMember(Member member) {
Member member1 = search(member.getMemberID());
if (member1 != null) {
memberList.remove(member1);
memberList.add(member);
} else {
System.out.println("This member not found.");
}
}

/**
* Search a member by his/her member ID
*
* @param memberID Id of member
* @return null if not found
*/
public Member search(String memberID) {
for (Member member : memberList) {
if (member.getMemberID().equals(memberID)) {
return member;
}
}
return null;
}

/**
* Search a member by his/her name
* @param fName first name of member
* @param lName last name of member
* @return null if not found
*/
public Member search(String fName, String lName) {
for (Member member : memberList) {
if (member.getName().getfName().equals(fName) && 
member.getName().getlName().equals(lName)) {
return member;
}
}
return null;
}


/**
* Point collection / discount privilege report
*
* @return report
*/
public String report() {
memberList.sort(new Comparator<Member>(){
@Override
public int compare(Member o1, Member o2) {
return -(o1.getPoint() - o2.getPoint());
}});
StringBuilder stringBuilder = new StringBuilder();
for (Member member : memberList) {
stringBuilder.append(member);
stringBuilder.append('\n');
}
return stringBuilder.toString();
}

/**
* add a member to member list
* @param scan scanner for command line tool
*/
public void addMember(Scanner scan) {
String fName = "";
String lName = "";
String iC = "";
String phoneNo = "";
String streetAddress;
int postcode;
String city;
String state;
String country;
System.out.print("Please input the first name: ");
fName = scan.nextLine();
if (fName == null || fName.isEmpty()) {
System.out.println("First name must not be empty!");
return;
}
System.out.print("Please input the last name: ");
lName = scan.nextLine();
if (lName == null || lName.isEmpty()) {
System.out.println("Last name must not be empty!");
return;
}
System.out.print("Please input the iC: ");
iC = scan.nextLine();
System.out.print("Please input the phone number: ");
phoneNo = scan.nextLine();
System.out.print("Please input the street address: ");
streetAddress = scan.nextLine();
while (true) {
System.out.print("Please input the postcode: ");
try {
postcode = Integer.parseInt(scan.nextLine());
} catch (Exception e) {
System.out.println("Postcode must be a number!");
continue;
}
break;
}
System.out.print("Please inout the city: ");
city = scan.nextLine();
System.out.print("Please input the state: ");
state = scan.nextLine();
System.out.print("Please input the country: ");
country = scan.nextLine();
Address address = new Address(streetAddress, postcode, city, state, country);
Member member = new Member(new Name(fName, lName), iC, phoneNo, address);
addMember(member);
}

/**
* search member by member id or member name
* @param scan scanner for command line tool
*/
public void search(Scanner scan) {
System.out.print("Search by (1. member ID 2. member name): ");
int option = 0;
try {
option = Integer.parseInt(scan.nextLine());
} catch (Exception e) {
System.out.println("Must input a number!");
return;
}
if (option <= 0 || option > 2) {
System.out.println("The number of option must be 1 or 2!");
return;
}
if (option == 1) {
System.out.print("Please input the member ID: ");
String memberID = scan.nextLine();
Member member = search(memberID);
if (member == null) {
System.out.println("This member not found.");
return;
} else {
System.out.print(member);
}
} else {
String fName = "";
String lName = "";
System.out.print("Please input the first name: ");
fName = scan.nextLine();
System.out.print("Please input the last name: ");
lName = scan.nextLine();
Member member = search(fName, lName);
if (member == null) {
System.out.println("This member not found.");
return;
} else {
System.out.print(member);
}
}
}

/**
* change information for a selected member
* @param scan scanner for command line tool
*/
public void changeInformation(Scanner scan) {
System.out.print("Please input the member ID: ");
String memberID = scan.nextLine();
Member member = search(memberID);
if (member == null) {
System.out.println("This member not found.");
return;
} else {
boolean quit = false;
while (true) {
System.out.print("Please select a field to modify \n(1.first name "
+ "2.last name 3.ic number 4.phone number 5.street address "
+ "6.postcode 7.city 8.state 9.country 10.quit) ");
String optionStr = scan.nextLine();
int option = 0;
try {
option = Integer.parseInt(optionStr);
} catch (Exception e) {
System.out.println("Must input a number!");
continue;
}
if (option <= 0 || option > 10) {
System.out.println("The number of option must be between 1 and 10!");
continue;
}
switch (option) {
case 1:
System.out.print("Please input the updated first name: ");
String fName = scan.nextLine();
if (fName == null || fName.isEmpty()) {
System.out.println("First name must not be empty!");
continue;
}
member.setName(new Name(fName, member.getName().getlName()));
System.out.println("Update successfully.");
break;
case 2:
System.out.print("Please input the updated last name: ");
String lName = scan.nextLine();
if (lName == null || lName.isEmpty()) {
System.out.println("Last name must not be empty!");
continue;
}
member.setName(new Name(member.getName().getfName(), lName));
System.out.println("Update successfully.");
break;
case 3:
System.out.print("Please input the updated iC: ");
String iC = scan.nextLine();
if (iC == null || iC.isEmpty()) {
System.out.println("IC number must not be empty!");
continue;
}
member.setIC(iC);
System.out.println("Update successfully.");
break;
case 4:
System.out.print("Please input the updated phone number: ");
String phoneNo = scan.nextLine();
member.setPhoneNo(phoneNo);
System.out.println("Update successfully.");
break;
case 5:
System.out.print("Please input the updated street address: ");
String streetAddress = scan.nextLine();
member.getaddress().setStreetAddress(streetAddress);
System.out.println("Update successfully.");
break;
case 6:
int postcode;
System.out.print("Please input the updated postcode: ");
try {
postcode = Integer.parseInt(scan.nextLine());
} catch (Exception e) {
System.out.println("Postcode must be a number!");
continue;
}
member.getaddress().setPostcode(postcode);
System.out.println("Update successfully.");
break;
case 7:
System.out.print("Please inout the updated city: ");
String city = scan.nextLine();
member.getaddress().setCity(city);
System.out.println("Update successfully.");
break;
case 8:
System.out.print("Please input the updated state: ");
String state = scan.nextLine();
member.getaddress().setState(state);
System.out.println("Update successfully.");
break;
case 9:
System.out.print("Please input the updated country: ");
String country = scan.nextLine();
member.getaddress().setCountry(country);
System.out.println("Update successfully.");
break;
case 10:
quit = true;
break;
}
if (quit)
break;
}
}
}

/**
* input a member id, delete this member if exists
* @param scan scanner for command line tool
*/
public void deleteMember(Scanner scan) {
System.out.print("Please input the member ID: ");
String memberID = scan.nextLine();
Member member = search(memberID);
if (member == null) {
System.out.println("This member not found.");
return;
} else {
memberList.remove(member);
System.out.println("Deleting this member successfully.");
}
}

/**
* add credit for a selected member
* @param scan scanner for command line tool
*/
public void addCredit(Scanner scan) {
System.out.print("Please input the member ID: ");
String memberID = scan.nextLine();
Member member = search(memberID);
if (member == null) {
System.out.println("This member not found.");
return;
} else {
System.out.print("Please input the credit value: ");
int topUpValue = 0;
try {
topUpValue = Integer.parseInt(scan.nextLine());
} catch (Exception e) {
System.out.println("Must input a number.");
return;
}
member.addCredit(topUpValue);
member.addPoint(topUpValue, 0);
System.out.println("Adding credit successfully.");
}
}

/**
* while loop running
*/
public void run() {
boolean quit = false;
Scanner scan = new Scanner(System.in);
while (true) {
System.out.println("*********************************************** Membership Management System **********************************************");
System.out.println("1. Add member 2. Search member 3. Change infomation 4. Delete member 5. Add credit 6. Membership report 7. quit");
System.out.println("***************************************************************************************************************************");
System.out.print("Please select one option: ");
String optionStr = scan.nextLine();
int option = 0;
try {
option = Integer.parseInt(optionStr);
} catch (Exception e) {
System.out.println("Must input a number!");
continue;
}
if (option <= 0 || option > 7) {
System.out.println("The number of option must be between 1 and 7!");
continue;
}
switch (option) {
case 1:
addMember(scan);
break;
case 2:
search(scan);
break;
case 3:
changeInformation(scan);
break;
case 4: 
deleteMember(scan);
break;
case 5:
addCredit(scan);
break;
case 6:
System.out.print(report());
break;
case 7:
quit = true;
break;
}
if (quit)
break;
}
}

public static void main(String[] args) {
Membership membership = new Membership();
Address address = new Address("street1", 123456, "city1", "state1", "country1");
Member member1 = new Member(new Name("fn1", "ln1"), "ic1", "11111", address);
member1.setPoint(100);
Member member2 = new Member(new Name("fn2", "ln2"), "ic2", "22222", address);
member2.setPoint(200);
Member member3 = new Member(new Name("fn3", "ln3"), "ic3", "33333", address);
member3.setPoint(50);
membership.addMember(member1);
membership.addMember(member2);
membership.addMember(member3);
// System.out.println(membership.report());
membership.run();
}
}
/**
* @(#)Name.java
*
*
* @author 
* @version 1.00 2019/8/1
*/


public class Name {
private String fName;
private String lName;

public Name() {
}

public Name(String fName,String lName) {
this.fName = fName;
this.lName = lName;
}

public String getfName()
{
return fName;
}

public String getlName()
{
return lName;
}

public void setfName(String fName)
{
this.fName = fName;
}

public void setlName(String lName)
{
this.lName = lName;
}

public String toString()
{
return String.format("Name:%s %s",fName,lName);
}
}
/**
* @(#)Person.java
*
*
* @author 
* @version 1.00 2019/8/1
*/


public class Person {
protected Name name;
protected String iC;
protected String phoneNo;
protected Address address = new Address();

public Person() {
}

public Person(Name name,String iC,String phoneNo,Address address) {
this.name = name;
this.iC = iC;
this.phoneNo = phoneNo;
this.address = address;
}
//get
public String getiC(){
return iC;
}

public String getphoneNo(){
return phoneNo;
}

public String getStringName()
{
return name.toString();
}

public String getStringAddress()
{
return address.toString();
}

public Name getName()
{
return name;
}

public Address getaddress(){
return address;
}
//set
public void setIC(String iC){
this.iC = iC;
}

public void setPhoneNo(String phoneNo){
this.phoneNo = phoneNo;
}

public void setName(Name name)
{
this.name = name;
}

public void setAddress(Address address)
{
this.address = address;
}

public String toString(){
return String.format("%s\nIc No:%s\nPhone Number:%s\nAddress:%s\n",name.toString(),iC,phoneNo,address.toString());
}
}
java array代写
java array代写
最先出自天才代写 java代写 java代写服务
合作:幽灵代写
 

天才代写-代写联系方式