What would an example of java code look like?
Producer class
- Declaring toolsPerHour as an instance variable
- Creating constructor that takes toolsPerHour
- Creating getter for toolsPerHour
- Method for calculating days produced
Tester class
- Creating 3 producer objects using constructor
- Setting toolsPerHour
- Calling methods
- Displaying output
How would I get this java code to work and with a main class
that would demo the rat class?
class rat {
private String name;
private String specialAbility;
private int TotalHealth;
private int shieldedHealth;
private int cooldown;
public rat()
{
}
public rat(String n,String SA,int TH,int SH,int cd)
{
name=n;
specialAbility=SA;
TotalHealth=TH;
shieldedHealth=SH;
cooldown=cd;
}
public void setname(String n)
{
name=n;
}
public String getname()
{
return name;
}
public void setability(String SA)
{
specialAbility=SA;
}
public String getability()...
Code in Java
Create a stack class to store integers and implement following
methods:
1) void push(int num): This method will push an integer to the
top of the stack.
2) int pop(): This method will return the value stored in the
top of the stack. If the stack is empty this method will return
-1.
3) void display(): This method will display all numbers in the
stack from top to bottom (First item displayed will be the top
value)....
JAVA CODE BEGINNERS, I already have the DEMO CLASS(NEED
YOU TO USE), I need you to use all methods, also switch
statements.
Write a Temperature class. The class will have three conversion
methods: toCelsius(), toKelvin() and toFahrenheit(). These methods
will return a Temperature in those three scales equal to the
this temperature. Note that the value of
this is not changed in these conversions. In
addition to these three conversion methods the class will have
methods add(Temperature), subtract(Temperature),
multiply(Temperature), and...
Question(Design Java Method).
There is a java code what created a "Student"
class and hold all the books owned by the student in the inner
class "Book". Please propose a new method for the
Student class so that given a Student object "student", a program
can find out the title of a book for which
student.hasBook(isbn) returns true. Show the method code
and the calls to it from a test program.
The Student class is following:
import java.lang.Integer;
import java.util.ArrayList;...
language is java
Use method overloading to code an operation class called
CircularComputing in which there are 3 overloaded methods as
follows:
computeObject(double radius)-compute area of a circle
computeObject(double radius, double height)-compute area of a
cylinder
computeObject(double radiusOutside, double radiusInside, double
height)-compute volume of a cylindrical object
These overloaded methods must have a return of computing result
in each
Then override toString() method so it will return the object
name, the field data, and computing result
Code a driver class...
Grocery Store using Java Arraylist
Requirements:
1. Need Product Class and Stock Class
2. Use arraylist to store/ add product in stock
3. Product must have name, code number and quantity in stock
4. Print list of the products and their stock quantity
5. Search products based on their name 6. Remove product based
on their code number
7. Sell product and deduct quantity from stock
8. Stock Class contains methods of search product, add product
and check quantity of...
IN JAVA!
Write a class Store which includes the attributes: store name,
city. Write another class encapsulating an Art Gallery, which
inherits from Store. An Art Gallery has the following additional
attributes: how many paintings are sold every year and the number
of artists submitting artwork.
Code the constructor, accessors, mutators, toString and equals
method of the super class Store. Code the constructor, accessors
and mutators for the subclass Art Gallery. In the Art Gallery
class, also code a method...