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
When we look for errors inside of our code on our own or with a partner , what is that called?
lutik1710 [3]
It’s called that he is cheating
6 0
2 years ago
Read 2 more answers
What port is typically reserved and utilized by the Secure Hypertext Transfer Protocol to create a secure connection to a Web se
jek_recluse [69]

Answer:

Port 443

Explanation:

This is the Hypertext Transfer Protocol Secure that combines the HTTP with a cryptographic protocol, which can be used for payment transactions and other secure transmission of data from Web pages. Whenever you connect to a website beginning with "https://" or you see the lock icon, you’re connecting to that web server over port 443.

4 0
3 years ago
1. Extract title Write a function extract_title that takes one parameter, the filename of a GenBank formatted file, and returns
trapecia [35]

Answer:

def extract_title(file):

   import re

   a =''

   with open(file,'r') as file:

       for line in file:

           a += line

       m = re.search("^(TITLE)(.*?)(JOURNAL)", a, re.M + re.S)

       print(m.groups()[1])

extract_title('new.txt')

Explanation:

The programming language used is python 3.

The function is first defined and the regular expression module is imported.

A variable is initialized to an empty string that will hold the content of the GenBank formatted file.

The file is opened and every line in the file is assigned to the string variable. The WITH statement allows files to be closed automatically.

Regular expression is used to capture all the files between TITLE and JOURNAL in a group.

The group is printed and the function is called.

I have attached a picture of the code in action.

6 0
3 years ago
Yuri, a medical assistant, has been asked to send an account of a patient's last office visit to another doctor's office. The te
g100num [7]
The internet,,

To let the other doctor know about specific details on the patient, and other excessive information.

Hope this helps!! :)
6 0
3 years ago
Read 2 more answers
You are most likely to use<br> images for photos or digital paintings.
Lubov Fominskaja [6]

Answer: Digital Paintings

7 0
3 years ago
Other questions:
  • You disassemble and reassemble a desktop computer. when you first turn it on, you see no lights and hear no sounds. nothing appe
    11·2 answers
  • Liz's meeting is scheduled to end at 9:30. It is 9:20 and team
    9·1 answer
  • ASAP FAST PLSKara is currently creating a storyboard for her web site. Which step of the web design process is she in? Coding Pl
    9·2 answers
  • Why is simplicity important in navigation design?
    13·1 answer
  • The welcome screen of the program 123D consists of ___
    15·1 answer
  • Initialized the variable with the value 0
    11·2 answers
  • Derive the three-dimensional transformation matrix for scaling an object by a scaling factor s in a direction defined by the dir
    15·1 answer
  • Laura is filming a scene in which the subject is sitting with a lit fireplace behind him. The only other source of light in the
    15·1 answer
  • Besides a backup technician, who else would have encrypted backup passwords?
    7·1 answer
  • How you use ict today and how will you use it tomorrow
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!