Question: Lab 2 CREATING A CLASS (3%) InternetBill class: Create a new NetBeans project called Lab02-InternetBill. Add a class with a main method called InternetBillTester to

Lab 2 CREATING A CLASS (3%)

InternetBill class:

Create a new NetBeans project called Lab02-InternetBill.

Add a class with a main method called InternetBillTester to the default package.

Add a new Java class called InternetBill to the default package:

o The class needs fields for

package type - the type of internet package

usage GBs consumed per month

customer name person who has purchased the internet package.

o Create getters and setters for all fields.

o Heres the UML (Unified Modelling Language) class diagram for it:

InternetBill

Attributes

private String customerName

private String packageName

private int usage

Operations

public String getCustomerName()

public String getPackageName()

public int getUsage()

public void setCustomerName(String newName)

public void setPackageName(String newName)

public void setUsage(int newUsage)

Note: You are allowed to change the names of instance variables/fields/attributes to your choice.

InternetBillTest Class:

In main:

o Create and initialize an object of the InternetBill class.

o Create and initialize a Scanner object.

o Using the Scanner object, ask the user for customer name, package name and

usage in GBs and assign the entered value to the appropriate property of your

InternetBill object. Alternatively, use JOptionPane methods to ask the user to enter

values.

o Print the details using your object's getter methods.

o Your output should look something like this with Scanner methods:

o Or like this with Dialog boxes:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!