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
Yuki888 [10]
3 years ago
8

Write the definitions of two classes Day and Night. Both classes have no constructors, methods or instance variables. Note: For

this exercise, please do not declare your classes using the public visibility modifier.
Computers and Technology
1 answer:
Colt1911 [192]3 years ago
4 0

Answer:

class Day

{

}  

class Night

{

}

Explanation:

Given

Two classes named: Day and Night

Requirement: Both classes have no constructors, methods or instance variables. should not be declared using the public visibility modifier.

The syntax to define a class in object oriented programming is

modifier class classname {

 // Constructor

 constructor(variablename) { ......}

 // Methods

 methods() { ... }

 ...

}

Access modifiers (or access specifiers) are keywords in object-oriented languages that set the accessibility of classes, methods, and other members. Examples are private, public, protected, etc.

Going by the syntax above to define class Day

Day

private class Day{

 // Constructor

 constructor(duration)

{

this.duration = duration;

}

 // Methods

CalculateDate() { ... }

}

But the question states that both classes have no constructors, methods or instance variables. should not be declared using the public visibility modifier.

So, class Day will be defined as follows

class Day

{

}

It could also be declared using visibility modifiers other than public modifier.  So, class Day will be defined as follows

private class Day

{

}

and

protected class Day

{

}

Similarly, class Night can be defined as follows

class Night

{

}

private class Night

{

}

and

protected class Night

{

}

You might be interested in
What dictionary operation can you use to remove all the keys within the dictionary-named contacts?
Ierofanga [76]

The dictionary operation that you use to remove all the keys within the dictionary-named contacts is contacts.clear().

<h3>What is dictionary add and remove element from dictionary?</h3>

The act of Removing elements from Dictionary is one that can delete a specific item in a dictionary by the use of the pop() method.

Note that this method deletes an item with the given key and returns the value .

Hence, The dictionary operation that you use to remove all the keys within the dictionary-named contacts is contacts.clear().

Learn more about dictionary operation  from

brainly.com/question/24680091

#SPJ1

3 0
1 year ago
A plan budget time for studying and activities is referred to as?
Lady_Fox [76]

Answer:

sorry u got scamed

Explanation:

4 0
3 years ago
You are an IT administrator troubleshooting a Windows-based computer. After a while, you determine that you need to refresh the
Tanya [424]

Answer:

gpupdate

Explanation:

My explanation was previously removed.

6 0
2 years ago
Develop a program that will calculate the area and perimeter of a rectangle. The length and width can be given as constant.(LENG
o-na [289]

Answer:

#include <iostream>

using namespace std;

int main()

{

 

  int length = 8;

  int width = 8;

 

  int perimeter = 2*(length + width);

  int area = length * width;

 

  cout<<"The perimeter is "<<perimeter<<endl;

  cout<<"The area is "<<area<<endl;

 

  return 0;

}

Explanation:

include the library iostream for using the input/output instructions in the c++ programming.

Create the main function and define the variable length and width with values.

Then, use the formula for calculating the perimeter and area of rectangle.

perimeter = 2*(length + width)

area = length * width

and store in the variables and finally print the output.

8 0
3 years ago
Which heading size fits for the word headings​
hjlf
The first one h4 is yhat
3 0
3 years ago
Read 2 more answers
Other questions:
  • When you tell a computer what to do, you are providing input?
    11·1 answer
  • _________ are represented using diamonds linked withparticipant ETs
    6·1 answer
  • Whats your favorite sport between these options?
    12·2 answers
  • What is the Documenter?
    10·1 answer
  • In computer logic what is order of instructions
    13·1 answer
  • What types of tools are used in the process of a digital or network investigation?
    12·1 answer
  • Two types of formulas in Excel, what are they? A. Complex and simple, B. General and currency, C. Logical and Boolean, D. Trig a
    15·1 answer
  • CMS is a content management system that collects, organization, publishes, and manages creative content. Right...?
    9·1 answer
  • Calculate the time complexity for the following function in terms of Big O notation. Explain your answer.
    13·1 answer
  • Which of these is a possible disadvantage of working with a team?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!