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]
2 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]2 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
It is possible to play older console games such as those written for the nintendo game boy or sega genesis on a personal compute
timurjin [86]
Emulator««««that is the answer
5 0
3 years ago
Ideally, how long or how many sentences should your video game pitch be?
Olin [163]
Good shot hdhhdbsb suhsbsbs bbsbsbsbdbbdbdbdbdbbd
6 0
3 years ago
1. A teacher asked a student to capture and print out a one-slide presentation using MSWord,       showing everything on the scr
Drupady [299]

The keyboard combinations that can be used to capture and print out a one-slide presentation using MSWord, showing everything on the screen is Function key + PrtScr

<h3>What is a Key Combination?</h3>

This refers to the procedure that is used to combine two or more keys on the keyboard to execute a task.

Hence, we can see that the procedure that can be used to carry out the operation is:

  • Enter the screen you want to capture and print
  • Press the Function key, followed by the PrtScr. Please note this can vary slightly, depending on the keyboard.

The hardware devices that would be needed to be set up by the system analyst at a computer laboratory are:

  • System Unit
  • Laptops/Monitor
  • Power adapters
  • Ethernet cables, etc

The database applications that can be recommended by the system analyst are:

  • MySQL,
  • SQL Server

The five word processing packages that are likely to be installed are:

  • G00..gle Docs
  • MsWord
  • MSOffice
  • Dropbox Paper
  • Corel WordPerfect

Read more about word processing here:

brainly.com/question/985406

#SPJ1

6 0
2 years ago
NTDS Quotas store NT Directory Service quota information that limits the number of Active Directory objects a user, group, compu
Anna35 [415]

Answer:

The anwer is advanced feature folder

Explanation:

Because NTDS QUOTAS is an advanced feature folder that stores NTDS quota information that limits the number of Active Directory objects a user, group, computer, or service can create.

3 0
3 years ago
Jack follows the steps below.
Eddi Din [679]

Answer:

D is my answer to this question.

5 0
3 years ago
Read 2 more answers
Other questions:
  • Heelo how do u do python syntax lesson 11 on code academy
    12·1 answer
  • In windows, a(n) ________ follows the file name and a period and indicates the file type.
    9·1 answer
  • The following types of websites are
    10·1 answer
  • Which of the following is true regarding the use of instance variable j in class B1?
    15·1 answer
  • The part of the computer that provides access to the Internet is the
    11·1 answer
  • What does the following Boolean operators do?<br>AND function<br>OR function<br>NOT function​
    8·1 answer
  • Prompt
    13·1 answer
  • How to fix a blue screen
    9·2 answers
  • NEED HELP ASAP!!!
    10·1 answer
  • Which operation is not efficiently supported by heaps?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!