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
If your address is 10 B Street, what are the first three bytes in ASCII
STALIN [3.7K]

They are 49, 48, 32

The 32 is important because it is a space.

3 0
3 years ago
Website administrators relay on ______, which is data such as the number of users who commented on, shared, viewed, or liked web
marin [14]

Answer:

b. analytics

Explanation:

-Hits are the amount of times that a website or program has been accessed.

-Analytics refers to the analysis of data to be able to make favorable decisions.

Cookies are files that are saved in a computer that are used to track the activity of a user in a website.

-Benchmaking is a technique in which a company compares its performance with businesses in the same industry.

According to this, the answer is that website administrators relay on analytics, which is data such as the number of users who commented on, shared, viewed, or liked webpage content.

3 0
2 years ago
Read 2 more answers
Simple mail transfer protocol (smtp) uses the well-known port number ______________ by default.
Elden [556K]
I believe it's default is port 587. 
8 0
3 years ago
Read 2 more answers
Universal Containers (UC) has decided to build a new, highly sensitive application on the Force platform. The security team at U
Tresset [83]

Use an AppExchange product that does fingerprint scanning with native Salesforce Identity  Confirmation

8 0
3 years ago
What is the full form of html​
zepelin [54]

Answer:

Hypertext Markup Language

Explanation:

Hypertext Markup Language

5 0
2 years ago
Read 2 more answers
Other questions:
  • Write an expression that evaluates to 1 more than the value in the location pointed to by the integer pointer variable ip. Thus,
    8·1 answer
  • what is the software that controls the storage, retrieval and manipulation of database stored in a database
    14·1 answer
  • What would be one advantage and one risk of using an electric car?
    14·2 answers
  • If you specify a user without specifying a hostname, mysql will
    13·1 answer
  • Search engine ranking evaluates the variables that search engines use to determine where a URL appears on the list of search res
    7·1 answer
  • Exchanging which type of data uses the least bandwidth?
    7·2 answers
  • 2.13) A simple rule to estimate your ideal body weight is to allow 110 pounds for the first 5 feet of height and 5 pounds for ea
    15·1 answer
  • Missy loves her old Windows games. When she upgrades her Windows system, the games run fine, but the output looks fuzzy since th
    15·1 answer
  • Breaking code rules is only a problem once in a while. Group of answer choices True False
    12·1 answer
  • What is a geam in the ggplot2 system?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!