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
Bess [88]
3 years ago
13

Write a class called SimpleSquare that has the following properties: - public int field called num - private int field called sq

uare - a constructor that takes a single parameter that sets the num, then sets square to num to the second power
Computers and Technology
1 answer:
mezya [45]3 years ago
6 0

Answer:

public class SimpleSquare{

   public int num;

   private int square;

   

   public SimpleSquare(int number){

       num = number;

       square = number * number;

   }

   

   public int getSquare(){

       return square;

   }    

}

Explanation:

*The code is in Java.

Create a class called SimpleSquare

Declare two fields, num and square

Create a constructor that takes an integer number as a parameter, sets the num and sets the square as number * number.

Since the square is a private field, I also added the getSquare() method which returns the value of the square.

You might be interested in
How are the internet and the World Wide Web different from each other
jeka94

The terms Internet and World Wide Web are often used interchangeably in everyday speech; it is common to speak it as " going on the Internet " when using a web browser to view web pages. However, the World Wide Web is only one of a large number of Internet services.

4 0
3 years ago
What does aperture control? A)amount of light the image sensor captures when taking a photo. B)how sensitive the camera is to in
My name is Ann [436]

Answer:

How sensitive the camera is to incoming light.

Explanation:

8 0
3 years ago
Read 2 more answers
Billy used to take care of his laptop. However, one day he lost his laptop. He lost all his data, and there was no way to retrie
Bad White [126]

Answer: D. He did not create a back up of his data.

Explanation: He lost his data, so he did not back it up in case he lost his laptop.

6 0
3 years ago
What is the highest numeral in a binary code?
Anarel [89]

Answer:

The highest numeral in binary code is 1

In binary, you can only have 1s and 0s

if you're asking for the biggest number that can be represented, it's 255, which is 11111111. (this is 8 1s)

Explanation:

Is this a trick question? lol

May I have brainliest please? :)

5 0
2 years ago
Site won't let me log in and is glitching? Is rainly down?
yarga [219]

Answer: Somewhat.

Explanation: Try refreshing your pages, or reopening your browser.

3 0
3 years ago
Read 2 more answers
Other questions:
  • If you plan on operating several applications at s time, the amount of RAM should be considered when purchasing a computer
    10·2 answers
  • In Excel, what happens to the cell contents when you click and drag a cell into multiple cells?
    14·1 answer
  • Give sally sue specific suggestions on how she can improve her powerpoint skills
    5·1 answer
  • Gemima wants to show the amount of vitamin C a fruit salad contains in the blue cell of the table below. To do this, she needs t
    9·2 answers
  • The idea that innovations in transportation and communication technologies has changed the way we think about distance and time
    9·1 answer
  • Can you send photos through messages on here?
    6·2 answers
  • Read the following example cover letter: To Ms. March: I was excited to see your opening for a customer support specialist with
    13·1 answer
  • Once the CPU has fetched the data requested, what are the next steps in the process?
    15·1 answer
  • I’ll give brainliest if answers are correct
    11·1 answer
  • Amogus :0) owo have a good day y'all
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!