//Solution 7
public class Person {
//Fields
private String name;
private String address;
private String phoneNumber;
//Default constructor
public Person()
{
name ="";
address ="";
phoneNumber = "";
}
//Overload Constructor
public Person(String name, String address, String phoneNumber)
{
this.name = name;
this.address = address;
this.phoneNumber = phoneNumber;
}
//getters and Setters
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
@Override
public String toString() {
return "Name: "+name+", Address: "+address+", Phone:
"+phoneNumber;
}
}
//==============================
public class Customer extends Person {
private int customerNumber;
private boolean isMailingList;
//Default Customer
public Customer()
{
//call super class constructor
super();
isMailingList = false;
customerNumber =0;
}
//Overload Constructor
public Customer(String name, String address, String phoneNumber,
int customerNumber, boolean isMailingList) {
super(name, address, phoneNumber);
this.customerNumber = customerNumber;
this.isMailingList = isMailingList;
}
//getters and setters
public int getCustomerNumber() {
return customerNumber;
}
public void setCustomerNumber(int customerNumber) {
this.customerNumber = customerNumber;
}
public boolean isMailingList() {
return isMailingList;
}
public void setMailingList(boolean mailingList) {
isMailingList = mailingList;
}
@Override
public String toString() {
return super.toString()+"\nCustomer Number: "+customerNumber+",
Wishing to add mailing list: "+isMailingList;
}
}
//=====================================
public class TestCustomer {
public static void main(String[] args)
{
//Create a customer using overload constructor
Customer customer1 = new Customer("John","2- abc street,
City","456-799-9090",101,true);
//Print info using toString()
System.out.println(customer1);
//Create another customer using default Constructor
Customer customer2 = new Customer();
//set Customer attributes
customer2.setCustomerNumber(102);
customer2.setMailingList(false);
customer2.setAddress("New york City");
customer2.setName("Mike");
customer2.setPhoneNumber("890-4567-900");
System.out.println();
//Print info using toString()
System.out.println(customer2);
}
}
//Output

//=========================
import java.text.DecimalFormat;
public class PreferredCustomer extends Customer {
private double amount;
private double discount;
//Default customer
public PreferredCustomer()
{
amount =0;
discount =0;
}
//Overload constructor
public PreferredCustomer(String name, String address, String
phoneNumber, int customerNumber, boolean isMailingList, double
amount) {
super(name, address, phoneNumber, customerNumber,
isMailingList);
this.amount = amount;
discount = calculateDiscount();
}
//getters
public double getAmount() {
return amount;
}
public double getDiscount() {
return discount;
}
/**
*
* @return discount based on customer spends
*/
public double calculateDiscount()
{
if(amount>=500 && amount<1000)
discount = 0.05;
else if(amount >= 1000 && amount <1500)
discount = 0.06;
else if(amount >=1500 && amount < 2000)
discount = 0.07;
else if(discount >= 2000)
discount = 0.10;
else
discount =0;
return discount;
}
//setters
public void setAmount(double amount) {
this.amount = amount;
}
/**
*
* @return String representation of object
*/
@Override
public String toString() {
return super.toString()+"\nAmount spends:
$"+String.format("%.2f",amount)+", Discount Earned:
"+calculateDiscount()*100+"%" ;
}
}
//===============================
public class TestPreferedCustomer {
public static void main(String[] args)
{
//Create customer
PreferredCustomer preferredCustomer=
new PreferredCustomer("Tim Marker","Pie Street, City
Enclave","567-8904=900",1001,true,1400);
//Print info using toString()
System.out.println(preferredCustomer);
}
}
//Output

//If you need any help regarding this solution...... please leave a comment.... thanks
this is java m. please use netbeans if you can. 7. Person and Customer Classes Design...
Assignment 6 Due: Apr 12, 2019 at 11:59 PM A6 OOP 3 "PreferredCustomer Class" (need to create Person, Customer classes described in the previous problem) Access A6 from pdf assignment file. Turn in the following files: a6main.java Customer.java Person.java PreferredCustomer.java program compile and run screenshots design document (including UML) A6 7. Person and Customer Classes esign a class named Person with fields for holding a person's name, address, and telephone number. Write one or more constructors and the appropriate mutator...
Please use Java Question 3: Person and Customer classes: Design a class named Person with properties for holding a person's name, address, and telephone number. Next, design a class named Customer, which is derived from the Person class. The Customer class should have a property for a customer number and a Boolean property indicating whether wishes to be on a mailing list. Demonstrate an object of customer class in a simple GUI application. Write the code include appropriate input validation,...
This must be written in C# with overloaded constructors and member initialization list 4. Person and Customer Classes Design a class named Person with properties for holding a person's name, address, and telephone number. Next, design a class named Customer, which is derived from the Person class. The Customer class should have a property for a customer number and a Boolean property indicating whether the customer wishes to be on a mailing list. Demonstrate an object of the Customer class...
Using JAVA* Design a class named Person with fields for holding a person’s name, address, and telephone number. Write one or more constructors and the appropriate mutator and accessor methods for the class’s fields. Next, design a class named Customer, which extends the Person class. The Customer class should have a field for a customer number and a boolean field indicating whether the customer wishes to be on a mailing list. Write one or more constructors and the appropriate mutator...
Design a class named Person with fields for holding a person's name, address, and telephone number (all as Strings). Write a constructor that initializes all of these values, and mutator and accessor methods for every field. Next, design a class named Customer, which inherits from the Person class. The Customer class should have a String field for the customer number and a boolean field indicating whether the customer wishes to be on a mailing list. Write a constructor that initializes...
JAVA HELP Design a class named Employee. The class should keep the following information in fields: Employee name Employee number in the format XXX–L, where each X is a digit within the range 0–9 and the L is a letter within the range A–M. Hire date then, Write one or more constructors and the appropriate accessor and mutator methods for the class. Next, write a class named ProductionWorker that extends the Employee class. The ProductionWorker class should have fields to...
This is a C++ program Instructions Design a class named PersonData with the following member variables declared as strings: lastName firstName address city state zip phone Create 3 constructors; a default constructor, a constructor that accepts the first and last name member variables, and a constructor that accepts all member variables. Write the appropriate accessor/getter and mutator/setter functions for these member variables. Create a method within this class called getFullName() that returns the person's first and last names as a...
need code for this in java
Design a set of classes that work together to simulate the Stock Transaction System. You should design the following classes: 1. the StockMarket class. This class simulates the stock market such as Nasdaq, NYSD, or other stock market. The class's responsibility are as follows: -To know the stock market abbreviation, full name, location, an arraylist of stocks for this market 2. the Company class: this class simulates a company that has stock released on...
Develop a set of classes for a college to use in various student service and personnel applications. Classes you need to design include the following: • Person — A Person contains the following fields, all of type String: firstName, lastName, address, zip, phone. The class also includes a method named setData() that sets each data field by prompting the user for each value and a display method that displays all of a Person’s information on a single line at the...
Overview This assignment will give you experience on the use of classes. Understand the Application Every internet user–perhaps better thought of as an Internet connection–has certain data associated with him/her/it. We will oversimplify this by symbolizing such data with only two fields: a name ("Aristotle") and a globally accessible IP address ("139.12.85.191"). We could enhance these by adding other—sometimes optional, sometimes needed—data (such as a MAC address, port, local IP address, gateway, etc), but we keep things simple and use...