Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Directions: Don't forget to add your Javadoc comments for your classes, constructor, and methods in this activity. Part 1: Customer-java Open a new Java file

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Directions: Don't forget to add your Javadoc comments for your classes, constructor, and methods in this activity. Part 1: Customer-java Open a new Java file in jGRASP and create a class called Customer. Create three instance variables: o String object for the customer's name o String object for the customer's location (town) o double to store the customer's balance Create a constructor for the Customer class that takes the Customer's name as a parameter. Set the location variable to an empty string and the balance to zero. You do not have to include the comments. . public Customer (String nameIn) f - nameIn; // sets name to parameter input :1/ sets location to empty string -0: 1/ sets balance to Create methods that set the customer's location, change the customer balance by an amount specified by a double parameter, get the location, and get the balance. That is, provide method bodies for the method headers below. Be sure to compile the completed methods before using them in interactions. ublic void setLocation (String locationIn) / sets location variable public void changeBalance (double amount) // add amount tob public String getLocation)/ returns variable for location public double getBalance ) // returns variable for balance . ance (double amount) // add amount to balance Try the following example in the interactions pane (you can leave out the comments): . customer cstmr = new customer ("Lane , Jane"); cstmr.changeBalance (3 0); // add S30 to balance - cstmr.getBalance() 30.0 cstmr.changeBalance (-5); // take $5 off balance cstmr. getBalance() 25.0 cstmr.setLocation( "Boston, MA) cstmr.getLocation() Boston, MA

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions