Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Adding amount of salary of 5 arrays of player objects? Main: System. out .print( Enter player's salary: ); double salary = input.nextDouble(); // user

Adding amount of salary of 5 arrays of player objects?

Main:

System.out.print("Enter player's salary: "); double salary = input.nextDouble(); // user enters player's salary (user is creating each individual player object here into array slots)

Team class:

double sum; //the total sum of 5 player's salary under a team

Player class:

private double salary; //salary of an individual Player

public void setSalary(double sal) { salary = sal; }

and

public double getSalary() { return salary; }

How would I create the method to add the sum of each Player's salary from the Player's class into the variable sum in the Team class? (like using a for loop in a mutator or something?)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Prepare a short profile of Lucy Clifford ?

Answered: 1 week ago

Question

Prepare a short profile of Rosa parks?

Answered: 1 week ago

Question

Prepare a short profile of victor marie hugo ?

Answered: 1 week ago

Question

Prepare a short profile of Henry words worth Longfellow?

Answered: 1 week ago