ublic void setLocation (String locationIn) / sets location variable public void changeBalance (double amount)// public String getLocation) / returns variable for location public double getBalance) /I returns variable for balance add amount to balance Try the following example in the interactions pane (you can leave out the comments) Customer cstmrnew Customer( "Lane, Jane") : cstmr.changeBalance(30) // add $30 to balance - cstmr.getBalance() 30.0 cstmr.changeBalance(-5) // take $5 off balance cstmr.getBalance() 25.0 tLocation( "Boston, MA") cstmr. Be sure to compile the completed methods before using them in interactions. That is, provide method bodies for the method headers below. Make sure the Add Files to Project Now check box is selected and click Create. COMP 1210 Activity 7B: Comparable Interface of 4 Due: Monday, Maby the end of lab Goals: By the end of this activity you should be able to do the following: Implement interfaces Overload methods Directions: Part 1: Customer.java (70) Open a new Java file in jGRASP and create a class called Customer. Type in Lab1Project as the Project Name, click Next. for design and implementation (4 points) while JGrasp and JCreator LE have. Try entering the following code into the interactions pane (recompile. public Customer (String nameIn) f - nameIn / sets name to parameter input :1/ sets location to empty string = 0 // sets balance to 0 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. Navigation paneCode editor paneInteractions pane 3LAB1Getting started with Java and jGraspCOMPSCI 121Part 2.2 Setting up a projectSelect the Project menu, New option. Learners can have high interactions with IDEs and they may use multiple. Part 1: Customer.java Open a new Java file in jGRASP and create a class called. ![]() Set the location variable to an empty string and the balance to zero. 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. ![]() ![]() Part 1: Customer.java Open a new Java file in jGRASP and create a class called Customer. If possible test the input in interactions pane. 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 Please follow the instructions given. 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.
0 Comments
Leave a Reply. |