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
aleksklad [387]
3 years ago
7

Define a public class named Sample with two instance variables: an int called count and a String called name. Provide a complete

constructor that allows both fields to be initialized when instances of Sample are created with count as its first parameter and name as its second. Neither count nor name should be public. Rather, you should provide: Both a getter and a setter for count Only a getter for name: this is how you can create a read-only variable in Java. Your getters and setters should follow the naming convention we have been using in class: get or set followed by the name of the field, capitalized. Getters should have the same return type as the variable that they are returning. Setters should not return a value.
Computers and Technology
1 answer:
Firlakuza [10]3 years ago
7 0

Answer:

The code to this question can be given as:

class Sample  //define class Sample.

{  

   //define private member.

 private int count;            

 private String name;

 Sample(int count, String name)           //define parameterized constructor.  

 {

   this.count = count;               //holding values.

   this.name = name;

 }

 public int getCount()                   //define function with returntype.

 {

   return count;

 }

 public String getName()         //define function with returntype.

 {

   return name;

 }

 public void setCount(int count)       //define function with no returntype.

 {

   this.count = count;

 }

public void setName(String name)         //define function with no returntype.

 {

   this.name = name;

 }

}

Explanation:

In the above code firstly we define the class that is Sample. In this class, we define two variable that is not public. Then we define the constructor. This code we parameterized constructor because it takes the values as a parameter. To assign the value in the constructor we use this keyword.  Then we used the get and set method. when we use get method because it returns a value (getcount and getname).  When we use the set method it does not return any value (setcount and setname).

You might be interested in
Write a program that reads the balance and annual percentage interest rate and displays the interest for the next month. Python
denis23 [38]

Answer:

Explanation:

The following code is written in Python. It asks the user to enter the current balance and the annual interest rate. It then calculates the monthly interest rate and uses that to detect the interest that will be earned for the next month. Finally, printing that to the screen. A test output can be seen in the attached picture below.

balance = int(input("Enter current Balance: "))

interest = int(input("Enter current annual interest %: "))

interest = (interest / 12) / 100

next_month_interest = balance * interest

print('$ ' + str(next_month_interest))

7 0
3 years ago
Name two commercial tools that can make a forensic sector-by-sector duplicate of a drive to a larger drive.
Temka [501]

Answer:

e34d4e

Explanation:

5 0
3 years ago
Write a python program to find the Area of Circle!<br>GRADE 8 CBSE​
barxatty [35]

Answer:

PI = 3.14

radius = float(input(' Please Enter the radius of a circle: '))

area = PI * radius * radius

circumference = 2 * PI * radius

Explanation:

i srs dont know i am so sorry i forgot but maybe this?

6 0
3 years ago
Which element is the first thing you should complete when making a movie?
AlekseyPX

Answer:

storyboard!!!

Explanation:

its important to have the concept in mind before starting

6 0
3 years ago
Read 2 more answers
Which of these utility tools would you least expect a support agent to find useful to increase security for end users?
tia_tia [17]

Answer:

b. Network performance monitor

Explanation:

A utility tool can be defined as a software application or program designed to add more functionality to a computer system, as well as to improve its performance efficiently. Some examples of commonly used utility tools in computer are file and folder backup tools, file management, antivirus, hard disk diagnostics, registry cleaner, network performance monitor, screensavers etc.

In the context of increasing security for the end users, the most important utility tools are;

1. Antivirus utility: to scan, detect, remove and prevent computer viruses such as Malware, Trojan horses, keyloggers, botnets, adwares etc.

2. Rootkit utility: it can be used to detect and remove any rootkit program that is hidden in a computer.

3. Spyware utility: this is used to detect, remove and prevent malicious adware that are found in software applications.

<em>However, a network performance monitor is a utility tool that would be found to least support an agent in increasing security for end users because it is a utility tool that is primarily used to monitor network traffic and amount of data usage. </em>

7 0
3 years ago
Other questions:
  • a computer that no longer works after having minor repair work done to it may have been damaged by ______.
    6·1 answer
  • A DTP firm has published and printed flyers for an upcoming fundraising event. In which section of the flyer would you find the
    6·2 answers
  • "giga" can mean both 109 and 230. explain to what each refers. can this cause confusion when reading a computer advertisement?
    15·1 answer
  • There is always this thing that comes out and I can't answer one's question. How do I undo this?
    12·2 answers
  • how to make assignment on power point plz cntct me and help me all about power point and my assignment is prime ministers of pak
    13·1 answer
  • What is the first priority when building or using vex robots
    10·2 answers
  • If we assume the modern view of existential import, why is the following syllogism invalid? No computer is made of clay. All com
    15·1 answer
  • What does a for loop look for in the sequence of data? Check all that apply.
    6·2 answers
  • You are writing a program to help compare two sports teams. A sample member of the list scores is [2. 5] where your team scored
    5·2 answers
  • Which statement best describes the computers all around us?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!