+1-415-670-9189
info@expertsmind.com
Create the mouse program
Course:- JAVA Programming
Reference No.:- EM13727402




Assignment Help
Assignment Help >> JAVA Programming

Question 1: Create the Mouse program. Test it with interesting data.

Question 2: Modify the MouseDriver program you just created in Question #1. Currently, it uses the same value of growthRate for both mice. Change the program so it accepts a different value of growthRate for each mouse. Test it with different growth rates for the two mice.

Question 3: Modify the MouseDriver program you just created in Question #2. Currently, it creates two mice. Create three mice. Use interesting names for the mice (instead "gus" and "jaq").

Question 4: Change the Mouse program you just created in Question #3. Instead of Mouse, use Tree. Instead of MouseDriver, use TreeDriver. Instead of days, useyears. Instead of weight, use height. Instead of the names of three mice, use the names of three tress, like fig and date and sequoia. Make the sequoia tree really, really tall. Remember to make appropriate changes to the print instruction. Test it with interesting data.

Question 5: Create a driver program that works with the following BankAccount class:

/***************************************
* BankAccount.java
* This class stores and prints information for a bank account.
***************************************/

public class BankAccount
{
private String customer; // customer's name
private int accountNum; // bank account number

// This method stores a customer's information:
public void setCustomer(String customer)
{
this.customer = customer;
}

// This method stores an account's number:
public void setAccountNum(int accountNum)
{
this.accountNum = accountNum;
}

// This method prints a bank account's information.
public void printAccountInfo()
{
System.out.println(
this.customer + "'s account number is " + this.accountNum + ".");
}
} // end class BankAccount

Test the program with interesting data for customer name and account number.

Question 6: Get the CircleDriver program from the brilliant PowerPoint lecture to work with the Circle class. Test it with interesting data.

Question 7: Create the Mouse2 program. Test it with interesting data.

~~~~~~~~~~~~~

Extra Credit:

1. When a method tries to return a double, and the method call is expecting anint, the program won't compile. Remember the Russian dolls? A double won't fit in an int.

Question: What happens when a method tries to return an int, and the method call is expecting a double? It should work, right? Modify the Mouse2Driver program and the Mouse2 class to find out!

2. Start with the Mouse2 and Mouse2Driver programs. Add a method that will copy the contents of one mouse into another mouse. Add a method to print all three variables. Then print the values of the variables in both mice to show they're the same.




Put your comment
 
Minimize


Ask Question & Get Answers from Experts
Browse some more (JAVA Programming) Materials
After this, create another program that could be used to take the words in words.txt and recreate the original sentence - this time printing the result to the screen. Please
I figured out how to work with the dates. Right now all it does is prompt for user name and birthday, and then output the information back along with age in years and days.
Java Swing Components and File Processing, Write a program named GuessGame.java that plays the game "guess the number" as follows. Your program chooses the number to be guess
Final result should be organized as a document which explains the overview and the structure of your program, real code, execution results (including captured image), and th
Implement 4 sorting algorithms in a Java " Sort " class. ( insertion sort, selection sort and quicksort, and mergesort). count the number of comparisons made.
Implement a single threaded game engine and single player user interface for a casino style dice game. The rules are simple, the player places a bet and then rolls two dice
Modify the Scholarship application so that if a user enters a grade point average under 0 or over 4.0, or a negative value for either of the activities, an error message appea
This is part 6 of the inventory program assignment from Java class IT 215 from UOP and all the codes are written well and includes everything all the functionality from the