1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vlabodo [156]
3 years ago
10

For this exercise, you are going to complete the printScope() method in the Scope class. Then you will create a Scope object in

the ScopeTester and call the printScope.
The method will print the name of each variable in the Scope class, as well as its corresponding value. There are 5 total variables in the Scope class, some of which can be accessed directly as instance variable, others of which need to be accessed via their getter methods.
For any variable that can be accessed directly, use the variable name. Otherwise, use the getter method.
Sample Output:
The output of the printScope method should look like this:
a = 5
b = 10
c = 15
d = 20
e = 25
public class ScopeTester
{
public static void main(String[] args)
{
// Start here!
}
}
public class Scope
{
private int a;
private int b;
private int c;
public Scope(){
a = 5;
b = 10;
c = 15;
}
public void printScope(){
//Start here
}
public int getA() {
return a;
}
public int getB() {
return b;
}
public int getC() {
return c;
}
public int getD(){
int d = a + c;
return d;
}
public int getE() {
int e = b + c;
return e;
}
}
Computers and Technology
1 answer:
iragen [17]3 years ago
4 0

Answer:

Explanation:

The following is the entire running Java code for the requested program with the requested changes. This code runs perfectly without errors and outputs the exact Sample Output that is in the question...

public class ScopeTester

{

public static void main(String[] args)

{

       Scope scope = new Scope();

       scope.printScope();

}

}

public class Scope

{

private int a;

private int b;

private int c;

public Scope(){

a = 5;

b = 10;

c = 15;

}

public void printScope(){

       System.out.println("a = " + a);

       System.out.println("b = " + b);

       System.out.println("c = " + c);

       System.out.println("d = " + getD());

       System.out.println("e = " + getE());

}

public int getA() {

return a;

}

public int getB() {

return b;

}

public int getC() {

return c;

}

public int getD(){

int d = a + c;

return d;

}

public int getE() {

int e = b + c;

return e;

}

}

You might be interested in
RDBMS stands for_________________
Aliun [14]
The term "RDBMS" stands for <span>relational database management system. 

I hope this helped! :)</span>
4 0
3 years ago
Assume that you have 22 slices of pizza and 7 friends that are going to share it (you've already eaten). There's been some argum
xz_007 [3.2K]

Answer:

In Python:

numberOfWholeSlices = int(22/7)

print(numberOfWholeSlices )

Explanation:

For each friend to get a whole number of slices, we need to make use of the int function to get the integer result when the number of slices is divided by the number of people.

So, the number of slice is: 22/7

In python, the expression when assigned to numberOfWholeSlices  is:

numberOfWholeSlices = int(22/7)

Next, is to print the calculated number of slices

print(numberOfWholeSlices )

4 0
3 years ago
Sue is installing a printer. What program will she need to get the printer to work with her computer? Specify some functionaliti
umka21 [38]

Answer:

Utility software tool​

Explanation:

After connecting the printer and turning it on, you'll need to install the printers software and drivers. Every printer should come with the software used to install a printer in Windows or your operating system.

8 0
2 years ago
Gemima has converted her table to a clustered column
Ber [7]

Answer:

1. Select the table

2. use Ctrl A

3. type the title

3 0
3 years ago
As we think of computer crime, there are ways in which thieves can steal your banking information through ATM machines. If you w
Travka [436]

Answer:NO, I WILL NOT GIVE THE TELEPHONE NUMBER

WHY?

IT IS A BREACH OF TRUST

IT IS A BREACH OF DATA PRIVACY

IT ALSO VIOLATES THE PRIVACY OF INFORMATION RIGHT OF THE GIRL.

Explanation:BREACH OF TRUST is act or actions taken against the signed agreement between a person and another party which may be any Organisation like a Financial Institution where the Financial Institution agrees not to release the personal Information about their customer without the person's consent.

IT IS A BREACH OF DATA PRIVACY many persons wants their data which are made available to Organisation to be kept private,divulging such information without the person's consent is a reach of data privacy.

It violates the privacy of Information right of the Girl, except for Security or other specified reasons no Organisations or person is given the right to divulge another person's right to a third party, ALL THESE VIOLATIONS ARE PUNISHABLE UNDER THE LAWS OF THE LAND.

4 0
3 years ago
Other questions:
  • What is an activity that can help you enhance the appearance of your computer’s desktop?
    12·2 answers
  • A(n) ____ is a collection of one or more program statements combined to perform some action
    14·1 answer
  • A file to which information is written is referred to as a(n) ____ file.
    8·1 answer
  • A study guide can be created
    6·2 answers
  • What is Processor to Memory Mismatch problem?
    15·1 answer
  • Text messaging is an example of nonverbal communication. Please select the best answer from the choices provided. T F
    7·2 answers
  • Why is it important to be part of a team in times you fail and in times you succeed?​
    15·1 answer
  • You will implement three different types of FFs with two different reset types. You have to show your results on your FPGA. You
    9·1 answer
  • Please help thank you !!!
    7·2 answers
  • Question 1 of 10 Which type of information systems personnel are involved in organizing information so that users can access it
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!