Question

Activity: Writing Classes Page 1 of 10 Terminology attribute / state behavior class method header class header instance varia
Activity: Writing Classes Page 2 of 10 private static final int OFFLINE = 0, ONLINE = 1; The constructor is used in conjuncti
Activity: Writing Classes Page 3 of 10 • The toString method returns a String representation of the object. Create and return
Activity: Writing Classes Page 4 of 10 Add a method to set the value of age. This will only change age if the age is greater
Activity: Writing Classes Page 5 of 10 After compiling your class, test each of your methods in the interactions pane. Your o
Activity: Writing Classes Page 6 of 10 ¡GRASP Project - Create ajGRASP project named User InfoDriver then add UserInfoDriver.
Activity: Writing Classes Page 7 of 10 • GRASP Canvas - In this part of the activity, you are to create a viewer canvas for y
Activity: Writing Classes Page 8 of 10 (2) Click the Step button on the canvas window or debug tab. This creates an instance
Activity: Writing Classes Page 9 of 10 Fede BD P Ses Tools Window Help le class for le state od s tlar for stem.out.pesa w )
Activity: Writing Classes Page 10 of 10 When you play your program, you will be stepping into cach of your methods. If it is
0 0
Add a comment Improve this question Transcribed image text
Answer #1

UserInfo. java
-----------------------

public class UserInfo {
  
   private String firstName;
   private String lastName;
   private String location= "Not specified";
   private int age=0;
   private static final int OFFLINE =0, ONLINE=1;
   private int status = OFFLINE;
  

   public UserInfo(String firstNameIn, String lastNameIn) {
       super();
       firstName = firstNameIn;
       lastName = lastNameIn;
   }

   @Override
   public String toString() {
       String output= " firstName : " + firstName + "\n lastName : " + lastName + "\n location : " + location + "\n age : " + age
               + "\n status : " + status;
       if(status==OFFLINE){
           output+= "offline";
       }
       else
       {
           output+= "online";
       }
      
       return output;
   }
  
   public boolean setAge(int ageIn){
       boolean isSet = false;
       if(ageIn>0){
           age=ageIn;
           isSet=true;
       }
      
       return isSet;
   }
  
   public int getAge(){
       return age;
   }
  
   public String getLocation(){
       return location;
   }
  
   public void logOff(){
       status=OFFLINE;
   }
  
   public void logOn(){
       status=ONLINE;
   }
  
   public void setLocation(String location) {
       this.location = location;
   }

   public static void main(String[] args) {
      
       UserInfo u = new UserInfo("Jane", "Lane");
       System.out.println(u);
      
       u.setAge(23);
       u.setLocation("Auburn");
       u.logOn();
       System.out.println(u);
      
   }

}

Problems @ Javadoc Declaration Con <terminated > UserInfo [Java Application) C:\Program firstName : Jane lastName : Lane loca

UserDriveInfo.java
----------------------

public class UserInfoDriver {

   public static void main(String[] args) {
       // TODO Auto-generated method stub
       UserInfo user1 = new UserInfo("Fat", "Doe");
       System.out.println("\n"+ user1);
       user1.setLocation("Aur=burn");
       user1.setAge(19);
       user1.logOn();
       System.out.println("\n"+ user1);
      
      
       UserInfo user2 = new UserInfo("Sam", "Jones");
       System.out.println("\n"+ user2);
       user2.setLocation("Aurburn");
       user2.setAge(19);
       user2.logOn();
       System.out.println("\n"+ user2);
   }

}

Problems @ Javadoc Declaration & Cons <terminated > UserInfoDriver (Java Application) C:\Pro JU firstName : Fat lastName : Do

The above programs are created as your instructions. I hope it helpful

Thank you.

Note: You can create UML diagrams in Eclipse IDE easily with these programs.

Add a comment
Know the answer?
Add Answer to:
Activity: Writing Classes Page 1 of 10 Terminology attribute / state behavior class method header class...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The current code I have is the following: package uml; public class uml {        public...

    The current code I have is the following: package uml; public class uml {        public static void main(String[] args) {              // TODO Auto-generated method stub        } } class Account { private String accountID; public Account(String accountID) { this.accountID = accountID; } public String getAccountID() { return accountID; } public void setAccountID(String accountID) { this.accountID = accountID; } @Override public String toString() { return "Account [accountID=" + accountID + "]"; } } class SuppliesAccount extends Account { private...

  • I need help writing my main method**** Computer Science 111 Introduction to Algorithms and Programming: Java...

    I need help writing my main method**** Computer Science 111 Introduction to Algorithms and Programming: Java Programming Project #4 – Classes and Objects (20 Points) You will create 3 new classes for this project, two will be chosen from the list below and one will be an entirely new class you invent.Here is the list: Shirt Shoe Wine Book Song Bicycle VideoGame Plant Car FootBall Boat Computer WebSite Movie Beer Pants TVShow MotorCycle Design First Create three (3) UML diagrams...

  • Concepts Tested in this Program: Class Design Constructors Objects Inheritance Program:   Design a class named Person...

    Concepts Tested in this Program: Class Design Constructors Objects Inheritance Program:   Design a class named Person and its two subclasses, Student and Employee. Make Faculty and Staff subclasses of Employee. A Person object has a name, address, phone number, and email address (all Strings). A Student Object has a class status (freshman, sophomore, junior, or senior). Define the status as a final String variable. An Employee Object has an office number, salary (both ints ), and a date hired. Use...

  • Assignment Requirements I have also attached a Class Diagram that describes the hierarchy of the inheritance...

    Assignment Requirements I have also attached a Class Diagram that describes the hierarchy of the inheritance and interface behaviors . The link to the PDF of the diagram is below MotorVehical.pdf Minimize File Preview User Define Object Assignment: Create a Intellij Project. The Intellij project will contain three user defined classes. The project will test two of the User Define Classes by using the invoking each of their methods and printing the results. You are required to create three UML...

  • Create a java project and create Student class. This class should have the following attributes, name...

    Create a java project and create Student class. This class should have the following attributes, name : String age : int id : String gender : String gpa : double and toString() method that returns the Student's detail. Your project should contain a TestStudent class where you get the student's info from user , create student's objects and save them in an arralist. You should save at least 10 student objects in this arraylist using loop statement. Then iterate through...

  • In a project named 'DogApplication', create a class called 'Dog' 1. declare two instance variables in...

    In a project named 'DogApplication', create a class called 'Dog' 1. declare two instance variables in 'Dog' : name (String type) age (int type) 2. declare the constructor for the 'Dog' class that takes two input parameters and uses these input parameters to initialize the instance variables 3. create another class called 'Driver' and inside the main method, declare two variables of type 'Dog' and call them 'myDog' and 'yourDog', then assign two variables to two instance of 'Dog' with...

  • Java file Name Dog Classes and Methods Create a constructor that incorporates the type, breed, and...

    Java file Name Dog Classes and Methods Create a constructor that incorporates the type, breed, and name variables (do not include topTrick). Note: The type refers to what the breed typically does; for example, a corgi would be a “cattle herding dog.” A Shiba Inu would be a “hunting dog.” Create the setTopTrick() mutator method Dog is parent class Corgi and Driver are subclasses Complete the Corgi class: Using the UML Class diagram, declare the instance variables. Create the two...

  • Implement the classes in the following class diagram. The Book class implements the Comparable interface. Use impl...

    Implement the classes in the following class diagram. The Book class implements the Comparable interface. Use implements Comparable<Book> in the class definition. Now, all book objects are instances of the java.lang.Comparable interface. Write a test program that creates an array of ten books. 1. Use Arrays.sort( Book[]l books) from the java.util package to sort the array. The order of objects in the array is determined using compareTo...) method. 2. Write a method that returns the most expensive book in the...

  • Please follow the instructions carefully. Thank you! For the second activity, I outputted the superhero class...

    Please follow the instructions carefully. Thank you! For the second activity, I outputted the superhero class below. SUPERHERO CLASS public class Superhero{   private String alias;   private String superpower;   private int health;   public Superhero(){       alias= "unkown";       superpower= "unknown";       health= 50; //Realized I did not use default constructor while going through instructions of lab   }   public Superhero(String alias1, String superpower1,int health1 ){       alias=alias1;       superpower=superpower1;       if(health1>=0 && health1<=50)           health= health1;       else if(health1<0||health1>50)           health=25;   }   public void setalias(String alias1){       alias=alias1;   }   public void setsuperpower(String...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT