Fraction, String, Date, and Array Problems in Java
VerifiedAdded on  2019/09/21
|26
|6874
|98
Homework Assignment
AI Summary
This Java programming assignment encompasses several distinct problems designed to test and enhance programming skills. The first part involves creating a `Fraction` class with methods for arithmetic operations, reduction, and comparison. The second part focuses on array manipulation, including creating and printing a string array in reverse order. The third part requires the creation of `MyDate` and `DateArray` classes to store and display dates. The fourth problem involves completing a `OneDimensionalArrays` class. Finally, the assignment culminates in a `FantasyFootball` simulation, requiring the implementation of a class to read, process, and display fantasy football scores and team averages. The solutions provided cover all aspects of the assignment, from basic class creation to complex array manipulation and data display. These solutions are available on Desklib to help students understand and solve similar problems.

Fraction Problem
Create a class called Fraction. Provide a constructor that takes 2 integers. Provide methods for
ï‚· toString
ï‚· setFraction
ï‚· equals
ï‚· add
ï‚· subtract
ï‚· multiple
ï‚· divide
ï‚· reduce - make sure you get the previous methods done before worrying about reduce.
The following will be your starting point:
package fractions;
import java.util.*;
public class Fraction
{
private Scanner scan = new Scanner(System.in);
private int num=1;
private int denom=1;
public Fraction()
{
}
public Fraction(int n, int d)
{
// Fill in code (good to use setFraction)
}
public void setFraction(int n, int d)
{
//Fill in code ... don't forget to reduce
}
public Fraction add(Fraction op)
{
//Fill in code ... don't forget to reduce
// Algebra HINT: a/b + c/d = (a*d + b*c)/(b*d)
}
public Fraction subtract(Fraction op)
{
//Fill in code ... don't forget to reduce
// Algebra HINT: a/b - c/d = (a*d - b*c)/(b*d)
}
Create a class called Fraction. Provide a constructor that takes 2 integers. Provide methods for
ï‚· toString
ï‚· setFraction
ï‚· equals
ï‚· add
ï‚· subtract
ï‚· multiple
ï‚· divide
ï‚· reduce - make sure you get the previous methods done before worrying about reduce.
The following will be your starting point:
package fractions;
import java.util.*;
public class Fraction
{
private Scanner scan = new Scanner(System.in);
private int num=1;
private int denom=1;
public Fraction()
{
}
public Fraction(int n, int d)
{
// Fill in code (good to use setFraction)
}
public void setFraction(int n, int d)
{
//Fill in code ... don't forget to reduce
}
public Fraction add(Fraction op)
{
//Fill in code ... don't forget to reduce
// Algebra HINT: a/b + c/d = (a*d + b*c)/(b*d)
}
public Fraction subtract(Fraction op)
{
//Fill in code ... don't forget to reduce
// Algebra HINT: a/b - c/d = (a*d - b*c)/(b*d)
}
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

public Fraction multiply(Fraction op)
{
//Fill in code ... don't forget to reduce
// Algebra HINT: a/b * c/d = (a*c)/ (b*d)
}
public Fraction divide(Fraction op)
{
//Fill in code ... don't forget to reduce
// Algebra HINT: a/b / c/d = (a*d)/ (b*c)
}
private void reduce()
{
// Pseudo code:
// set smaller = minimum ( abs(num), abs(denom));
// Loop through the possible divisors: 2, 3, 4, ... smaller
// For each possible divisor:
// while (num and denom are evenly divisible by divisor)
// {
// num /= divisor;
// denom /= divisor;
// smaller /= divisor;
// }
}
public boolean equals(Fraction f)
{
// Assuming all fractions are reduced
// Fill in code
}
public String toString()
{
// Fill in code
}
public void readin(String label)
{
while (true) // Keep trying if bad input is received
{
System.out.print(label);
String temp = scan.next();
temp = temp.trim(); // get rid of white space at the beginning and
end
int index = temp.indexOf('/');
if (index >= 0)
{
String numStr = temp.substring(0, index);
String denomStr = temp.substring(index+1);
int n = Integer.parseInt(numStr);
int d = Integer.parseInt(denomStr);
setFraction(n,d);
{
//Fill in code ... don't forget to reduce
// Algebra HINT: a/b * c/d = (a*c)/ (b*d)
}
public Fraction divide(Fraction op)
{
//Fill in code ... don't forget to reduce
// Algebra HINT: a/b / c/d = (a*d)/ (b*c)
}
private void reduce()
{
// Pseudo code:
// set smaller = minimum ( abs(num), abs(denom));
// Loop through the possible divisors: 2, 3, 4, ... smaller
// For each possible divisor:
// while (num and denom are evenly divisible by divisor)
// {
// num /= divisor;
// denom /= divisor;
// smaller /= divisor;
// }
}
public boolean equals(Fraction f)
{
// Assuming all fractions are reduced
// Fill in code
}
public String toString()
{
// Fill in code
}
public void readin(String label)
{
while (true) // Keep trying if bad input is received
{
System.out.print(label);
String temp = scan.next();
temp = temp.trim(); // get rid of white space at the beginning and
end
int index = temp.indexOf('/');
if (index >= 0)
{
String numStr = temp.substring(0, index);
String denomStr = temp.substring(index+1);
int n = Integer.parseInt(numStr);
int d = Integer.parseInt(denomStr);
setFraction(n,d);

return;
}
else
System.out.println("Input Fraction missing / ");
}//Keep trying until you get it right
}
public static void main(String[] args)
{
Fraction f1= new Fraction();
Fraction f2= new Fraction();
Fraction f3=null;
Scanner scan = new Scanner(System.in);
while(true)
{
System.out.println(); // Add a blank line
System.out.print("Enter operation: + - * / q (q ==> quit) : ");
String input = scan.next();
if (input.charAt(0) == 'q')
break; // All done
f1.readin("Enter Fraction 1: ");
f2.readin("Enter Fraction 2: ");
System.out.println("f1 = " + f1);
System.out.println("f2 = " + f2);
if (f1.equals(f2))
System.out.println("f1 and f2 are equal");
else
System.out.println("f1 and f2 are not equal");
switch (input.charAt(0))
{
case '+':
f3 = f1.add(f2);
System.out.println("f1+f2=" + f3);
break;
case '-':
f3 = f1.subtract(f2);
System.out.println("f1-f2=" + f3);
break;
case '*':
f3 = f1.multiply(f2);
System.out.println("f1*f2="+f3);
break;
case '/':
f3 = f1.divide(f2);
System.out.println("f1/f2="+f3);
break;
default:
}
else
System.out.println("Input Fraction missing / ");
}//Keep trying until you get it right
}
public static void main(String[] args)
{
Fraction f1= new Fraction();
Fraction f2= new Fraction();
Fraction f3=null;
Scanner scan = new Scanner(System.in);
while(true)
{
System.out.println(); // Add a blank line
System.out.print("Enter operation: + - * / q (q ==> quit) : ");
String input = scan.next();
if (input.charAt(0) == 'q')
break; // All done
f1.readin("Enter Fraction 1: ");
f2.readin("Enter Fraction 2: ");
System.out.println("f1 = " + f1);
System.out.println("f2 = " + f2);
if (f1.equals(f2))
System.out.println("f1 and f2 are equal");
else
System.out.println("f1 and f2 are not equal");
switch (input.charAt(0))
{
case '+':
f3 = f1.add(f2);
System.out.println("f1+f2=" + f3);
break;
case '-':
f3 = f1.subtract(f2);
System.out.println("f1-f2=" + f3);
break;
case '*':
f3 = f1.multiply(f2);
System.out.println("f1*f2="+f3);
break;
case '/':
f3 = f1.divide(f2);
System.out.println("f1/f2="+f3);
break;
default:
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

System.out.println("Illegal command: " + input );
break;
}
}// end of while loop
System.out.println("Bye");
} // end of main
}
Please try to run the following Fraction calculations:
(note the answers are filled with ______)
Enter operation: + - * / q (q ==> quit) : +
Enter Fraction 1: 1/3
Enter Fraction 2: 4/6
f1 = 1/3
f2 = 2/3
f1 and f2 are not equal
f1+f2=_________
Enter operation: + - * / q (q ==> quit) : +
Enter Fraction 1: 5/25
Enter Fraction 2: 10/50
f1 = 1/5
f2 = 1/5
f1 and f2 are equal
f1+f2=_________
Enter operation: + - * / q (q ==> quit) : +
Enter Fraction 1: 7/30
Enter Fraction 2: 11/20
f1 = 7/30
f2 = 11/20
f1 and f2 are not equal
f1+f2=_________
Enter operation: + - * / q (q ==> quit) : -
Enter Fraction 1: 11/12
Enter Fraction 2: 4/5
f1 = 11/12
f2 = 4/5
f1 and f2 are not equal
f1-f2=_________
Enter operation: + - * / q (q ==> quit) : *
Enter Fraction 1: 5/6
Enter Fraction 2: 1/4
f1 = 5/6
f2 = 1/4
break;
}
}// end of while loop
System.out.println("Bye");
} // end of main
}
Please try to run the following Fraction calculations:
(note the answers are filled with ______)
Enter operation: + - * / q (q ==> quit) : +
Enter Fraction 1: 1/3
Enter Fraction 2: 4/6
f1 = 1/3
f2 = 2/3
f1 and f2 are not equal
f1+f2=_________
Enter operation: + - * / q (q ==> quit) : +
Enter Fraction 1: 5/25
Enter Fraction 2: 10/50
f1 = 1/5
f2 = 1/5
f1 and f2 are equal
f1+f2=_________
Enter operation: + - * / q (q ==> quit) : +
Enter Fraction 1: 7/30
Enter Fraction 2: 11/20
f1 = 7/30
f2 = 11/20
f1 and f2 are not equal
f1+f2=_________
Enter operation: + - * / q (q ==> quit) : -
Enter Fraction 1: 11/12
Enter Fraction 2: 4/5
f1 = 11/12
f2 = 4/5
f1 and f2 are not equal
f1-f2=_________
Enter operation: + - * / q (q ==> quit) : *
Enter Fraction 1: 5/6
Enter Fraction 2: 1/4
f1 = 5/6
f2 = 1/4
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

f1 and f2 are not equal
f1*f2=_________
Enter operation: + - * / q (q ==> quit) : /
Enter Fraction 1: 6/7
Enter Fraction 2: 1/12
f1 = 6/7
f2 = 1/12
f1 and f2 are not equal
f1/f2=_________
Enter operation: + - * / q (q ==> quit) : q
Bye
string_array
Create a package named string_array and write a program that creates an array of Strings with
the name of "firstNames".
Fill the array with the names(in this order): "George", "Fred", "Sam", "Mary", "Sarah", "Bella",
"Joy", "Rita", "Marta", "Sue", "Nancy"
Print the values of the firstNames array backwards. In otherwords, your output should be:
Nancy Sue Marta Rita Joy Bella Sarah Mary Sam Fred George
Run the program and insert the results in the appropriate section of the JH5 worksheet.
date_array
Create a package named date_array and you will need 2 classes. Create a class called MyDate.
This class only needs the following things:
ï‚· Instance variables for month, day and year
f1*f2=_________
Enter operation: + - * / q (q ==> quit) : /
Enter Fraction 1: 6/7
Enter Fraction 2: 1/12
f1 = 6/7
f2 = 1/12
f1 and f2 are not equal
f1/f2=_________
Enter operation: + - * / q (q ==> quit) : q
Bye
string_array
Create a package named string_array and write a program that creates an array of Strings with
the name of "firstNames".
Fill the array with the names(in this order): "George", "Fred", "Sam", "Mary", "Sarah", "Bella",
"Joy", "Rita", "Marta", "Sue", "Nancy"
Print the values of the firstNames array backwards. In otherwords, your output should be:
Nancy Sue Marta Rita Joy Bella Sarah Mary Sam Fred George
Run the program and insert the results in the appropriate section of the JH5 worksheet.
date_array
Create a package named date_array and you will need 2 classes. Create a class called MyDate.
This class only needs the following things:
ï‚· Instance variables for month, day and year

ï‚· Constructor: MyDate(String month, int day, int year) - the code stores the values in 3
instance variables
ï‚· String toString() method - returns a String containing your 3 instance variables.
Create another class called DateArray that creates an array of "MyDate" with the name of
"dateArr".
The array should have 4 entries and the entries should be filled with MyDate classes representing
the dates:
May 16, 1984
November 14, 1978
September 21, 1980
July 3, 1987
The DateArray class should print the values of the dateArr array backwards. Your MyDate
classes can be printed using a toString() method in the MyDate class.
Run the program and insert the results in the appropriate section of the JH5 worksheet.
one_dimensional_array problem (15 points):
Create a package named one_dimensional_array and write a class that completes the following
"OneDimensionalArrays" class. You will complete the class by filling in code wherever you see
the comment:
//******* FILL IN CODE *********
import java.util.Scanner;
public class OneDimensionalArrays {
int[] createIntegers(int size_of_array)
{
//******* FILL IN CODE *********
// Your code will create an array of ints as large as specified in
size_of_array
// Fill the array in with the values: 0, 100, 200, 300, ....
// Return the array that you just created
}
void printArray(int[] myArray)
{
instance variables
ï‚· String toString() method - returns a String containing your 3 instance variables.
Create another class called DateArray that creates an array of "MyDate" with the name of
"dateArr".
The array should have 4 entries and the entries should be filled with MyDate classes representing
the dates:
May 16, 1984
November 14, 1978
September 21, 1980
July 3, 1987
The DateArray class should print the values of the dateArr array backwards. Your MyDate
classes can be printed using a toString() method in the MyDate class.
Run the program and insert the results in the appropriate section of the JH5 worksheet.
one_dimensional_array problem (15 points):
Create a package named one_dimensional_array and write a class that completes the following
"OneDimensionalArrays" class. You will complete the class by filling in code wherever you see
the comment:
//******* FILL IN CODE *********
import java.util.Scanner;
public class OneDimensionalArrays {
int[] createIntegers(int size_of_array)
{
//******* FILL IN CODE *********
// Your code will create an array of ints as large as specified in
size_of_array
// Fill the array in with the values: 0, 100, 200, 300, ....
// Return the array that you just created
}
void printArray(int[] myArray)
{
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

//******* FILL IN CODE *********
// Print out your array with one number per line. Get the size of the
// array from the "myArray" parameter (no hard coding the size)
}
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter size of array to create: ");
int num = keyboard.nextInt();
//******* FILL IN CODE *********
// Construct an instance of the OneDimensionalArrays class
// Using this object instance, call createIntegers to create
// an array of integers. Don't forget to save the results
// Then call the printArray method to print out the contents
// of your array.
}
}
Run your program and insert the results in the appropriate section of the JH5 worksheet.
// Print out your array with one number per line. Get the size of the
// array from the "myArray" parameter (no hard coding the size)
}
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter size of array to create: ");
int num = keyboard.nextInt();
//******* FILL IN CODE *********
// Construct an instance of the OneDimensionalArrays class
// Using this object instance, call createIntegers to create
// an array of integers. Don't forget to save the results
// Then call the printArray method to print out the contents
// of your array.
}
}
Run your program and insert the results in the appropriate section of the JH5 worksheet.
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Fantasy Football Problem
This exercise is very similar to the GradeBook.java example near the end of
Chapter 6
of your textbook. Make sure you have watched the video "GradeBook and Fantasy
Football" found
in the " Arrays Part2" section. The Textbook's GradeBook example does many of
the same things
that you will need to do in your Fantasy Football program.
However, instead of a teacher grade book, we have the following
fantasy football scores:
Create a FantasyFootball.java class to read in the information in the above
table.
One of the differences in the overall structure is the fact that in Gradebook
we didn't have any
Student names. In Fantasy Football we want a name for each team. This will
require adding an
additional array to store the names of the teams. You will simplify your
efforts if the names of your
teams do not include spaces. Then you can use next() instead of nextLine()
and your code will be simplified.
You will get most of the credit for this assignment even if your output is not
completely
aligned as shown in the above image. Note that if you use the technique from
GradeBook.java
you will get a ragged looking table.
Getting the table aligned as seen in the above image will give you the last 5
points on this
problem.
You can get the alignment to look somewhat OK, if you use tab characters to go
to new columns
and round the double values to integer values with a cast operation.
This exercise is very similar to the GradeBook.java example near the end of
Chapter 6
of your textbook. Make sure you have watched the video "GradeBook and Fantasy
Football" found
in the " Arrays Part2" section. The Textbook's GradeBook example does many of
the same things
that you will need to do in your Fantasy Football program.
However, instead of a teacher grade book, we have the following
fantasy football scores:
Create a FantasyFootball.java class to read in the information in the above
table.
One of the differences in the overall structure is the fact that in Gradebook
we didn't have any
Student names. In Fantasy Football we want a name for each team. This will
require adding an
additional array to store the names of the teams. You will simplify your
efforts if the names of your
teams do not include spaces. Then you can use next() instead of nextLine()
and your code will be simplified.
You will get most of the credit for this assignment even if your output is not
completely
aligned as shown in the above image. Note that if you use the technique from
GradeBook.java
you will get a ragged looking table.
Getting the table aligned as seen in the above image will give you the last 5
points on this
problem.
You can get the alignment to look somewhat OK, if you use tab characters to go
to new columns
and round the double values to integer values with a cast operation.

However, you can get perfect alignment using the System.printf(....) approach
we have shown before.
Consider the following examples of printf and println:
String s ="something";
double d = 5.4321;
int x = 3456;
System.out.printf("%20s", s); //Field of 20 characters, right justified
string
System.out.printf("%-20s", s); //Field of 20 characters, left justified
string
System.out.printf("%8d", x); //Field of 8 characters, right justified
integer
System.out.prinf("%-8d", x); //Field of 8 characters, left justified
integer
System.out.println(); // Go to a new line
You should start with the "Starting Code" shown below.
Starting Code
package fantasy_football;
import java.util.Scanner;
public class FantasyFootball
{
private int numberOfTeams; // Same as teamAverage.length.
private int numberOfWeeks; // Same as weekAverage.length.
private int[][] scores; //numberOfTeams rows and numberOfWeeks columns.
private double[] weekAverage; // contains an entry for each week
private double[] teamAverage; // contains an entry for each team
private String[] teamName; // contains an entry for each team
public void enterInData( )
{
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter number of teams:");
numberOfTeams = keyboard.nextInt( );
System.out.println("Enter number of weeks:");
numberOfWeeks = keyboard.nextInt( );
// ************** Fill in Code ***************
// Allocate array memory for teamName to store the team names.
// Allocate array memory for scores (2 dimensional array) to store a
// score for each team for each week.
we have shown before.
Consider the following examples of printf and println:
String s ="something";
double d = 5.4321;
int x = 3456;
System.out.printf("%20s", s); //Field of 20 characters, right justified
string
System.out.printf("%-20s", s); //Field of 20 characters, left justified
string
System.out.printf("%8d", x); //Field of 8 characters, right justified
integer
System.out.prinf("%-8d", x); //Field of 8 characters, left justified
integer
System.out.println(); // Go to a new line
You should start with the "Starting Code" shown below.
Starting Code
package fantasy_football;
import java.util.Scanner;
public class FantasyFootball
{
private int numberOfTeams; // Same as teamAverage.length.
private int numberOfWeeks; // Same as weekAverage.length.
private int[][] scores; //numberOfTeams rows and numberOfWeeks columns.
private double[] weekAverage; // contains an entry for each week
private double[] teamAverage; // contains an entry for each team
private String[] teamName; // contains an entry for each team
public void enterInData( )
{
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter number of teams:");
numberOfTeams = keyboard.nextInt( );
System.out.println("Enter number of weeks:");
numberOfWeeks = keyboard.nextInt( );
// ************** Fill in Code ***************
// Allocate array memory for teamName to store the team names.
// Allocate array memory for scores (2 dimensional array) to store a
// score for each team for each week.
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

for (int team = 0; team < numberOfTeams; team++)
{
System.out.println("Enter team name");
// ************* Fill in Code **************
// Read in Team name and store it in teamName
for (int week = 0; week < numberOfWeeks; week++)
{
System.out.println("Enter score for team "+ teamName[team]);
System.out.println("on week number " + (week+1));
// ************ Fill in Code ***************
// Read in a score and store it in the proper spot in the
scores array
}
}
}
public void fillTeamAverage( )
{
//********* Fill in Code *************
// Allocate memory for the teamAverage.
// Each entry in this array will contain the
// average weekly score for a given team.
}
public void fillWeekAverage( )
{
//*********** Fill in Code *************
// Allocate memory for the weekAverage instance variable.
// Each entry in this array will contain the average of
// all teams for a given week.
}
public void display( )
{
//********* Fill in Code ****************
// This method will print out the display that was shown above.
// At this point all of the information can be found in the
// private instance variables of the FantasyFootball class
}
public static void main(String[] args)
{
FantasyFootball f= new FantasyFootball();
f.enterInData();
f.fillTeamAverage();
f.fillWeekAverage();
{
System.out.println("Enter team name");
// ************* Fill in Code **************
// Read in Team name and store it in teamName
for (int week = 0; week < numberOfWeeks; week++)
{
System.out.println("Enter score for team "+ teamName[team]);
System.out.println("on week number " + (week+1));
// ************ Fill in Code ***************
// Read in a score and store it in the proper spot in the
scores array
}
}
}
public void fillTeamAverage( )
{
//********* Fill in Code *************
// Allocate memory for the teamAverage.
// Each entry in this array will contain the
// average weekly score for a given team.
}
public void fillWeekAverage( )
{
//*********** Fill in Code *************
// Allocate memory for the weekAverage instance variable.
// Each entry in this array will contain the average of
// all teams for a given week.
}
public void display( )
{
//********* Fill in Code ****************
// This method will print out the display that was shown above.
// At this point all of the information can be found in the
// private instance variables of the FantasyFootball class
}
public static void main(String[] args)
{
FantasyFootball f= new FantasyFootball();
f.enterInData();
f.fillTeamAverage();
f.fillWeekAverage();
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

f.display();
}
}
************************************
Sample Output from your program:
Enter number of teams:
4
Enter number of weeks:
3
Enter team name
Blind_Pigeons
Enter score for team Blind_Pigeons
on week number 1
123
Enter score for team Blind_Pigeons
on week number 2
95
Enter score for team Blind_Pigeons
on week number 3
121
Enter team name
Spittn_Lamas
Enter score for team Spittn_Lamas
on week number 1
54
Enter score for team Spittn_Lamas
on week number 2
98
Enter score for team Spittn_Lamas
on week number 3
83
Enter team name
Nut_Zippers
Enter score for team Nut_Zippers
on week number 1
70
Enter score for team Nut_Zippers
on week number 2
74
Enter score for team Nut_Zippers
on week number 3
103
Enter team name
Bucking_Broncos
Enter score for team Bucking_Broncos
on week number 1
108
Enter score for team Bucking_Broncos
on week number 2
119
Enter score for team Bucking_Broncos
on week number 3
81
********************************
output from display() with ragged output
********************************
Blind_Pigeons 123 95 121 Ave = 113
}
}
************************************
Sample Output from your program:
Enter number of teams:
4
Enter number of weeks:
3
Enter team name
Blind_Pigeons
Enter score for team Blind_Pigeons
on week number 1
123
Enter score for team Blind_Pigeons
on week number 2
95
Enter score for team Blind_Pigeons
on week number 3
121
Enter team name
Spittn_Lamas
Enter score for team Spittn_Lamas
on week number 1
54
Enter score for team Spittn_Lamas
on week number 2
98
Enter score for team Spittn_Lamas
on week number 3
83
Enter team name
Nut_Zippers
Enter score for team Nut_Zippers
on week number 1
70
Enter score for team Nut_Zippers
on week number 2
74
Enter score for team Nut_Zippers
on week number 3
103
Enter team name
Bucking_Broncos
Enter score for team Bucking_Broncos
on week number 1
108
Enter score for team Bucking_Broncos
on week number 2
119
Enter score for team Bucking_Broncos
on week number 3
81
********************************
output from display() with ragged output
********************************
Blind_Pigeons 123 95 121 Ave = 113

Spittn_Lamas 54 98 83 Ave = 78
Nut_Zippers 70 74 103 Ave = 82
Bucking_Broncos 108 119 81 Ave = 102
Weekly Ave: 88 96 97
********************************
output from display() using printf
********************************
Team Name Week 1 Week 2 Week 3
Blind_Pigeons 123 95 121 ave = 113
Spittn_Lamas 54 98 83 ave = 78
Nut_Zippers 70 74 103 ave = 82
Bucking_Broncos 108 119 81 ave = 102
Weekly Ave: 88 96 97
Person, Student, Family Problem
Create a class called Person. Person should have (instance variables should
be private):
private String name;
private int age;
2 Constructors:
Default constructor (no parameters)
Constructor which takes 2 parameters for name and age
Methods:
toString
equals
Nut_Zippers 70 74 103 Ave = 82
Bucking_Broncos 108 119 81 Ave = 102
Weekly Ave: 88 96 97
********************************
output from display() using printf
********************************
Team Name Week 1 Week 2 Week 3
Blind_Pigeons 123 95 121 ave = 113
Spittn_Lamas 54 98 83 ave = 78
Nut_Zippers 70 74 103 ave = 82
Bucking_Broncos 108 119 81 ave = 102
Weekly Ave: 88 96 97
Person, Student, Family Problem
Create a class called Person. Person should have (instance variables should
be private):
private String name;
private int age;
2 Constructors:
Default constructor (no parameters)
Constructor which takes 2 parameters for name and age
Methods:
toString
equals
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide
1 out of 26

Your All-in-One AI-Powered Toolkit for Academic Success.
 +13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.