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
StreamPal is an audio-streaming application for mobile devices that allows users to listen to streaming music and connect with o
valentina_108 [34]

Answer:

Users of the application may have the ability to determine information about the locations of users that are not on their contact list.

6 0
3 years ago
Evan accidentally entered an incorrect word when he was typing a document. Which keyboard shortcut should he use to undo the err
agasfer [191]
CTRL Z is the redo action so thats your best bet
8 0
3 years ago
Read 2 more answers
Which commands are on the right-most side of the Title bar? (From Microsoft Word)
jeyben [28]
<h2>Answer:</h2>

Title bar is the top most bar of a window. As obvious from the name, it has the title of the program in use. It has name of the program or more specifically the name of currently open document is written in this horizontal bar.

The option/commands present in the right most o the title bar are as follows:

  • Close
  • Maximize/Resize
  • Minimize

Close command is needed to exit the program/application. A cross icon is used as close command. Maximize/Resize command helps to expand the window to the screen pane as well as allows the user to adjust the screen of application accordingly. Two squares icon is used as a button for this command. Minimize command helps by shutting the app to the task bar so that it can be expanded/maximized later. A dash/line icon is used as a button for this command.

<h2>I hope it will help you!</h2>

6 0
3 years ago
Different between internet and email​
pentagon [3]

Answer:

The internet allows you to connect with people and information around the world. The internet is more broad and could include searching things up or message-based websites. Emails is more specific, with it being when you send someone a message (called an email) on a mail website (that allows you to get messages from other people, websites, etc.)

Explanation:

In my answer.

5 0
3 years ago
How are headers and footers are useful in presentation​
Svetradugi [14.3K]

Answer:

Explanation:

PowerPoint is a software that allows user to create headers as well as footers which are information usually appears at the top of the slides and the information that appears at the bottom of all slides. Headers and footers are useful when making presentation in these ways:

✓ Both provide quick information about one's document/ data clearly in a predictable format. The information that is provided by the Header and footers typically consist of ;

©name of the presenters,

©the presentation title

©slide number

©date and others.

✓ They help in setting out different parts of the document.

✓Since the Headers and footers can appear on every slide, corporate confidentiality as well as copyright information can be added to footer area to discourages those that can steal ones secrete.

7 0
3 years ago
Other questions:
  • The most commonly used traffic control devices used in road construction and maintenance work areas are
    10·1 answer
  • When Twitter is used to gather a large group for a face-to-face meeting it is called a
    10·1 answer
  • TOPIC-PYTHON
    8·2 answers
  • The following equations estimate the calories burned when exercising (source): Men: Calories = ( (Age x 0.2017) — (Weight x 0.09
    11·1 answer
  • Arrange the following units of storage in descending<br> order. B, TB,KB, GB,MB
    5·1 answer
  • Send the memes whoever is the best will get that crown thing lol
    10·2 answers
  • The visitor's age is stored in the variable age, the day of the week is stored in a variable day, and the price in dollars is st
    8·1 answer
  • Examples of pop in computer​
    14·1 answer
  • Consider legal issues and intellectual property concerns when creating computer programs?
    11·1 answer
  • What should you implement to leverage power, cooling, and networking capabilities independent from other datacenters in a region
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!