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]
2 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]2 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
Write a function called missing_letters that takes a string parameter and returns a new string with all the letters of the alpha
kompoz [17]

A string parameter and returns new string with all the letters of the alphabet that are not in the argument string. The letters in the returned string should be in alphabetical order. The implementation should uses a histogram from the histogram function

Explanation:

The below code is written in python :

alphabet = "abcdefghijklmnopqrstuvwxyz"

test_dups = ["zzz","dog","bookkeeper","subdermatoglyphic","subdermatoglyphics"]

test_miss = ["zzz","subdermatoglyphic","the quick brown fox jumps over the lazy dog"]

def histogram(s):

   d = dict()

   for c in s:

       if c not in d:

           d[c] = 1

       else:

           d[c] += 1

   return d

def has_duplicates(s):

   for v in histogram(s).values():

       if v > 1:

           return True

   return False

def test_dups_loop():

   for s in test_dups:

       print(s + ':', has_duplicates(s))

def missing_letters(s):

   r = list('abcdefghijklmnopqrstuvwxyz')

   s = s.lower()

   for c in s.lower():

       if c in r:

           r.remove(c)  # the first matching instance

   return ''.join(r)

def test_miss_loop():

   for s in test_miss:

       print(s + ':', missing_letters(s))

def main():

   test_dups_loop()

   test_miss_loop()

if __name__ == '__main__':

   main()

6 0
3 years ago
which two partitions do you typically create at minimum during a fedora linux installation? (choose two answers.)
algol [13]

/ and swap

When you install Fedora Linux, the "/" and "swap" partitions are created by default. However, you can create additional partitions if you want. Here's a look at the minimum partitions you need for a Fedora Linux installation.

The "/" partition is the root partition. This is where the operating system is installed. The minimum size for this partition is 1 GB.

The "swap" partition is used for virtual memory. The minimum size for this partition is 2 GB.

You can create additional partitions for storage, but these are the minimum partitions you need for a Fedora Linux installation.

Learn more here:

brainly.com/question/13487450

#SPJ4

5 0
1 year ago
It is used to select specific menu options, drag and drop options and to draw something on screen.
Novay_Z [31]

Answer:

A mouse.

Explanation:

An input device can be defined as any device that is typically used for sending data to a computer system.

Generally, all of the output and input device of a computer are known as peripheral (external) devices and they provide data (informations) to the end users in various formats such as video, audio, texts, images etc.

Since input devices are peripheral (external) devices, they can be connected to the computer system wirelessly or through a wired-connection (cable).

Some examples of peripheral (external) devices are monitor, speakers, keyboard, printer, scanner, projector, mouse, etc.

A mouse is an input device that is designed and used to select specific menu options, drag and drop options and to draw something on screen.

8 0
2 years ago
Which of the following is your personal record of payments and bill-paying?
oksian1 [2.3K]

Answer:

I believe its a statement

Explanation:

4 0
3 years ago
A document with a(n) ____ guarantees that the document was indeed sent by a specific individual and that it hasn t been tampered
BARSIC [14]
The answer is A) digital signature
8 0
3 years ago
Other questions:
  • The number of bits used to store color information about each pixel is called ____.
    13·1 answer
  • Explain how Deep Packet Inspection works (DPI). How is this technology beneficial to Perimeter Security? Lastly, describe a scen
    6·1 answer
  • Which term is used to describe a password-protected, encrypted data file that verifies the identity of the sender of a message?
    8·1 answer
  • You are evaluating the bounce rate of your overall website traffic and find that users with a social media referral source have
    9·1 answer
  • What is an example of a transition effectl
    7·1 answer
  • Claire is trying to listen to her history professor's lecture, but her mind keeps wandering to thoughts about her plans for the
    5·1 answer
  • Which of the following instructions should be allowed only in kernel mode? (a) Disable all interrupts. (b) Read the time-of-day
    11·1 answer
  • A folder has been shared with other users and set to read-only. What does this mean for users?
    12·2 answers
  • Write a list comprehension that creates a list containing the numbers that result from the values 1 through 10 being multiplied
    15·1 answer
  • Which of the following statements about ip addresses is true?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!