Question
pleaae help with these two...
QUESTION 12 Create a class called Fish with the following variables (4) Type of fish . . Weight in whole ounces . Length in fractional inches. Write a default constructor for the class. (2) Write a constructor where the values are being passed in (3) Write the get and set for just the variable weight of the fish (NOT for the other two variables). (4) Write a method called public double calculatePrice( double price) which calculates the price of the fish by multiplying the weight of the fish by the price. (3) b)Write another class called FishApp which has the main. Create an object for the fish where type is Salmon, weight is 64 ounces and length is 1.20 feet Create an input variable for the price and ask the user to input the price and call the method calculatePrice to calculate the price of the fish (10 points) T T T Paragraph Arial
Explanation / Answer
If you post more than 1 question, as per chegg guidelines I have to solve only 1 question.
Ques 13.
public int arraySize( int[] arr )
{
// if the array contains no element
if( arr.length == 0 )
System.out.println("Array is Empty.");
else if( arr.length < 20 )
{
int i;
// print the array elements
for( i = 0 ; i < arr.length ; i++ )
System.out.print(arr[i] + " ");
}
// if array contains 20 or more elements
else
System.out.println("Array is too big to print.");
}