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.
A retail store has a preferred customer plan where customers can earn discounts on all their purchases. The amount of discount depends on customer's cumulative purchases in the store and the business rules for discounts is as follows:
• When a preferred customer spends $500, he or she gets a 5 % discount on all future purchases.
• When a preferred customer spends $1000, he or she gets a 6 % discount on all future purchases.
• When a preferred customer spends $1500, he or she gets a 7 % discount on all future purchases.
• When a preferred customer spends $2000, he or she gets a 10 % discount on all future purchases.
Design a class called PreferredCustomer, which is derived from the Customer class you created in No 3.
The PreferredCustomer class should have properties for the amount of the customer's purchases and the customer's discount level. Demonstrate the class in a simple GUI application.
• Write the code include appropriate input validation, error and exception handling code.
//////////////////////////
public class Person {
private String name;// store name
private String address;// store address
private long telephoneNo; // store telephone number
// constructor
public Person(){
// initialize
this.name="";
this.address="";
this.telephoneNo=0;
}
// setter , if error on catting return false , otherwise true
public boolean setName(String a){
try{
this.name=a;
return(true);
}
catch(Exception e){
return(false);
}
}
public boolean setAddress(String a){
try{
this.address=a;
return(true);
}
catch(Exception e){
return(false);
}
}
public boolean setTelephoneNo(String a){
try{
this.telephoneNo=Long.parseLong(a);
return(true);
}
catch(Exception e){
return(false);
}
}
// getter
public String getName(){return(this.name);}
public String getAddress(){return(this.address);}
public long getTelephoneNo(){return(this.telephoneNo);}
// to string method
public String toString(){
String ret="";
ret+="\nName : "+this.name;
ret+="\nAddress : "+this.address;
ret+="\nTelephone Number : "+this.telephoneNo;
return(ret);
}
}
/////////////////////////////
public class Customer extends Person{
private String custNo;// store customer id
private boolean toBeMailLst;// to be list in mail
// constructor
public Customer(){
// call base class
super();
// initialize
this.custNo="";
this.toBeMailLst=false;
}
// setter , if error on catting return false , otherwise true
public boolean setCustNo(String a){
try{
this.custNo=a;
return(true);
}
catch(Exception e){
return(false);
}
}
public boolean setToBeMailLst(String a){
if(a.toUpperCase().equals("TRUE")){
this.toBeMailLst=true;
return(true);
}
else{
if(a.toUpperCase().equals("FALSE")){
this.toBeMailLst=false;
return(true);
}
else{
return(false);
}
}
}
public String getCustNo(){return(this.custNo);}
public Boolean sgetToBeMailLst(){return(this.toBeMailLst);}
// to string method
public String toString(){
String ret="";
ret+="\nCustomer Number : "+this.custNo;
ret+="\nTo be on a mailing list : ";
if(this.toBeMailLst==true){
ret+="Yes";
}
else{
ret+="No";
}
ret+=super.toString();
return(ret);
}
}
////////////////////////////////
public class PreferredCustomer extends Customer{
private double amount;// store amount
private double discountLvl;// store discount
// constructor
public PreferredCustomer(){
// call base class
super();
// initialize
this.amount=0;
this.discountLvl=0;
}
// setter , if error on catting return false , otherwise true
public boolean setAmount(String d){
try{
this.amount=Double.parseDouble(d);
// set discount amount
if(this.amount>=500.0){
this.discountLvl=5;
}
if(this.amount>=1000.0){
this.discountLvl=5;
}
if(this.amount>=1500.0){
this.discountLvl=7;
}
if(this.amount>=2000.0){
this.discountLvl=10;
}
return(true);
}
catch(Exception e){
return(false);
}
}
// getter
public double getAmount(){
return(this.amount);
}
public double getDiscount(){
return(this.discountLvl);
}
// to string method
public String toString(){
String ret="";
ret+="\nAmount $"+this.amount;
ret+="\nDiscount "+this.discountLvl+"%";
ret+=super.toString();
return(ret);
}
}
///////////////////////////////////////////////
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class Custgui extends Application {
@Override
public void start(Stage primaryStage) {
Label lbl1 = new Label("\tName");
Label lbl2 = new Label("\tAddress");
Label lbl3 = new Label("\tTelephone Number");
Label lbl4 = new Label("\tCustomer Number");
Label lbl5 = new Label("\tTo be add in mail list");
TextField text1 = new TextField();
TextField text2 = new TextField();
TextField text3 = new TextField();
TextField text4 = new TextField();
TextField text5 = new TextField();
Button btn = new Button();
btn.setText("Check Class");
btn.setOnAction(new EventHandler<ActionEvent>() {
private Object MessageBox;
private Object Dialogs;
@Override
public void handle(ActionEvent event) {
PreferredCustomer pc=new PreferredCustomer();
boolean b1=pc.setName(text1.getText());
boolean b2=pc.setAddress(text2.getText());
boolean b3=pc.setTelephoneNo(text3.getText());
boolean b4=pc.setCustNo(text4.getText());
boolean b5=pc.setToBeMailLst(text5.getText());
Alert al=new Alert(Alert.AlertType.INFORMATION);
if(b1 && b2 && b3 && b4 &&
b5){
al.setTitle("Object Data");
al.setContentText(pc.toString());
al.show();
}
else{
String s="";
if(b1==false){
s+="\nError in Name";
}
if(b2==false){
s+="\nError in Address";
}
if(b3==false){
s+="\nError in Telephone Number";
}
if(b4==false){
s+="\nError in Customer Number";
}
if(b5==false){
s+="\nError , Write [ true or false ] ";
}
al.setTitle("Error On Data");
al.setContentText(s);
al.show();
}
}
});
GridPane gridPane = new GridPane();
gridPane.setHgap(10);
gridPane.setVgap(10);
gridPane.add(lbl1, 0, 0, 1, 1);
gridPane.add(lbl2, 0, 1, 1, 1);
gridPane.add(lbl3, 0, 2, 1, 1);
gridPane.add(lbl4, 0, 3, 1, 1);
gridPane.add(lbl5, 0, 4, 1, 1);
gridPane.add(text1, 1, 0, 1, 1);
gridPane.add(text2, 1, 1, 1, 1);
gridPane.add(text3, 1, 2, 1, 1);
gridPane.add(text4, 1, 3, 1, 1);
gridPane.add(text5, 1, 4, 1, 1);
gridPane.add(btn, 1, 6, 1, 1);
StackPane root = new StackPane();
root.getChildren().add(gridPane);
Scene scene = new Scene(root, 300, 250);
primaryStage.setTitle("Check Object Customer");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}

//////////////////////////////////////////////////
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class Custgui extends Application {
@Override
public void start(Stage primaryStage) {
Label lbl1 = new Label("\tName");
Label lbl2 = new Label("\tAddress");
Label lbl3 = new Label("\tTelephone Number");
Label lbl4 = new Label("\tCustomer Number");
Label lbl5 = new Label("\tTo be add in mail list");
Label lbl6 = new Label("\tCustomer Spent");
TextField text1 = new TextField();
TextField text2 = new TextField();
TextField text3 = new TextField();
TextField text4 = new TextField();
TextField text5 = new TextField();
TextField text6 = new TextField();
Button btn = new Button();
btn.setText("Check Class");
btn.setOnAction(new EventHandler<ActionEvent>() {
private Object MessageBox;
private Object Dialogs;
@Override
public void handle(ActionEvent event) {
PreferredCustomer pc=new PreferredCustomer();
boolean b1=pc.setName(text1.getText());
boolean b2=pc.setAddress(text2.getText());
boolean b3=pc.setTelephoneNo(text3.getText());
boolean b4=pc.setCustNo(text4.getText());
boolean b5=pc.setToBeMailLst(text5.getText());
boolean b6=pc.setAmount(text6.getText());
Alert al=new Alert(Alert.AlertType.INFORMATION);
if(b1 && b2 && b3 && b4 && b5
&& b6){
al.setTitle("Object Data");
al.setContentText(pc.toString());
al.show();
}
else{
String s="";
if(b1==false){
s+="\nError in Name";
}
if(b2==false){
s+="\nError in Address";
}
if(b3==false){
s+="\nError in Telephone Number";
}
if(b4==false){
s+="\nError in Customer Number";
}
if(b5==false){
s+="\nError , Write [ true or false ] ";
}
if(b6==false){
s+="\nError in Amount";
}
al.setTitle("Error On Data");
al.setContentText(s);
al.show();
}
}
});
GridPane gridPane = new GridPane();
gridPane.setHgap(10);
gridPane.setVgap(10);
gridPane.add(lbl1, 0, 0, 1, 1);
gridPane.add(lbl2, 0, 1, 1, 1);
gridPane.add(lbl3, 0, 2, 1, 1);
gridPane.add(lbl4, 0, 3, 1, 1);
gridPane.add(lbl5, 0, 4, 1, 1);
gridPane.add(lbl6, 0, 5, 1, 1);
gridPane.add(text1, 1, 0, 1, 1);
gridPane.add(text2, 1, 1, 1, 1);
gridPane.add(text3, 1, 2, 1, 1);
gridPane.add(text4, 1, 3, 1, 1);
gridPane.add(text5, 1, 4, 1, 1);
gridPane.add(text6, 1, 5, 1, 1);
gridPane.add(btn, 1, 6, 1, 1);
StackPane root = new StackPane();
root.getChildren().add(gridPane);
Scene scene = new Scene(root, 300, 250);
primaryStage.setTitle("Check Object PreferredCustomer");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}

Please use Java Question 3: Person and Customer classes: Design a class named Person with properties...
this is java m. please use netbeans if you can.
7. Person and Customer Classes 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 cus- tomer wishes to...
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...
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...
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...
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...
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 for python named PersonData with the following member variables: lastName firstName address city state zip phone Write the appropriate accessor and mutator functions for these member variables. Next, design a class named CustomerData , which is derived from the PersonData class. The CustomerData class should have the following member variables: customerNumber mailingList The customerNumber variable will be used to hold a unique integer for each customer. The mailingList variable should be a bool . It will be...
Programming Project 3 See Dropbox for due date Project Outcomes: Develop a Java program that uses: Exception handling File Processing(text) Regular Expressions Prep Readings: Absolute Java, chapters 1 - 9 and Regular Expression in Java Project Overview: Create a Java program that allows a user to pick a cell phone and cell phone package and shows the cost. Inthis program the design is left up to the programmer however good object oriented design is required. Project Requirements Develop a text...
Create an Inheritance hierarchy that a bank may use to represent customer's bank accounts (Checking and Savings), this includes a GUI user interface that allows user to login, and deposit or withdraw, and application to display the transaction and final balance. All the bank customers can: - Create a new account - Deposit (Credit) money into their account and/or withdraw (debit) money from their account. - Application should expect user to login to their account using login/password Create necessary classes...
Please i need helpe with this JAVA code. Write a Java program simulates the dice game called GAMECrap. For this project, assume that the game is being played between two players, and that the rules are as follows: Problem Statement One of the players goes first. That player announces the size of the bet, and rolls the dice. If the player rolls a 7 or 11, it is called a natural. The player who rolled the dice wins. 2, 3...