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]
2 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]2 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
Creating a map of your current knowledge is called __________.
poizon [28]

Answer:

D - Concept-mapping

Explanation:

3 0
3 years ago
What was the purpose of the Internet Architecture Board?
Nata [24]

Answer:

c to help build the internets infrastrucuter

Explanation:

6 0
2 years ago
Read 2 more answers
Write a program that asks the user to enter a number of seconds and then printsthe same amount of time in days, hours, minutes,
MariettaO [177]

Answer:3363 seconds

Explanation:3363 is equivalent to 0days 1 hour, 1 min, and 7 sec

8 0
3 years ago
Who is the father of modern computer?​
nydimaria [60]

Answer:

I would say Alan Turing is the father of the modern computer

7 0
3 years ago
Read 2 more answers
32 what windows command can be used to copy entire directories, including subdirectories?
navik [9.2K]
Ctrl+a copies everything.
5 0
2 years ago
Other questions:
  • What is used for World Wide Web?
    7·1 answer
  • Speed is how fast an object moves a certain distance within a length of time. How is speed calculated?
    14·2 answers
  • Charts are more effective in attaining attentionthen others methods of presenting data. Do you agree?
    10·1 answer
  • Assume that sentence is a variable that has been associated with a string consisting of words separated by single space characte
    5·1 answer
  • Which line in the following program contains the header for the showDub function? 1 #include 2 using namespace std; 3 4 void sho
    9·1 answer
  • lance has three tables in his database. He wants to generate a report to show data from the three tables. Therefore, he decides
    7·2 answers
  • Como hago para poner brainly en español???
    12·2 answers
  • Number are stored and transmitted inside a computer in the form of​
    6·1 answer
  • Create a two functions: first called grocery_cost(food), where food can be one item or a list of items from the stock and price
    7·1 answer
  • AI is not embraced everywhere in every industry because _______.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!