Repository navigation
Expand file tree
/
Copy pathproject_27.java
More file actions
32 lines (23 loc) · 1.62 KB
/
Copy pathproject_27.java
File metadata and controls
32 lines (23 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* Project 27 from Java Master Class, OOP Part 1: Constructors - Part 2 */
/* Challenge *****************************************************************************
1. Create a new class called VipCustomer. It should have 3 fields: name, credit limit, & email address.
2.Create 3 constructors
a. 1st constructor empty should call the constructor with 3 parameters with default values
b. 2nd constructor should pass 2 values and add a default value for the 3rd
c. 3rd constuctor should save all fields
3. Create getters only for this code generation as setters will not be needed
4. Test and confirm it works
*/
import repo.VipCustomer;
public class project_27{
public static void main(String[] args){
VipCustomer Wolfman = new VipCustomer();
VipCustomer Mummy = new VipCustomer("Mummy", 50000.00);
System.out.println("Wolfman's info: " + Wolfman.getName() + ", credit limit: " + Wolfman.getCreditLimit() + ", email address: " + Wolfman.getEmailAddress());
System.out.println("Dracula's info: " + Dracula.getName() + ", credit limit: " + Dracula.getCreditLimit() + ", email address: " + Dracula.getEmailAddress());
System.out.println("Mummy's info: " + Mummy.getName() + ", credit limit: " + Mummy.getCreditLimit() + ", email address: " + Mummy.getEmailAddress());
System.out.println("Frankenstein's info: " + Frankenstein.getName() + ", credit limit: " + Frankenstein.getCreditLimit() + ", email address: " + Frankenstein.getEmailAddress());
}
}