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
skad [1K]
3 years ago
13

Provide instance fields for title, month, and year (for example, "Scientific American", "April", 2020). Each of these should be

accessible only within the Magazine class.Create a constructor, which initializes the instance fieldsWrite a toString() method, modeled after the standard Java toString() method, to return a String representation of the Magazine.Write an equals() method, modeled after the standard Java equals() method. Two Magazines are equal if they have the same title, month, and year.HTML EditorKeyboard Shortcuts

Computers and Technology
1 answer:
miskamm [114]3 years ago
4 0

Answer:

Check the explanation

Explanation:

Note : check attached image for output and program and also note that you're to replace "at" with shift 2 as the brainly text editor can't take the symbol

Program : **************Magzine.java**********************

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

public class Magzine {

 

//class variable private can not access outside class

private String title;

private String month;

private int year;

 

//parameterized constructor

public Magzine(String title,String month,int year)

{

this.title=title;

this.month=month;

this.year=year;

}

 

//override toString method

"at"Override

public String toString()

{

String detail=title+" "+month+" "+Integer.toString(year);

return detail;//return string of class variable

}

 

//get Magzine objecte

 

public boolean equals(Magzine obj)

{

//commented returm statement compare string by address so you can uncomment if

//we do not use same string object of String class

//return this.month==obj.month && this.title==obj.title && this.year==obj.year;

//compare two object element if matches return true else false

return (this.month.equals(obj.month)) &&(this.title.equals(obj.title)) && this.year==obj.year;

}

   

}

Program : *************************Main.java****************************

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

public class Main {

/**

* "at"param args the command line arguments

*/

public static void main(String[] args) {

// TODO code application logic here

Magzine Obj =new Magzine("Scientific American ", "April", 2020); //object of class

Magzine Obj1 =new Magzine("Scientific American ", "April", 2020);//Obj and obj1 is same content data

Magzine Obj2 =new Magzine("Scientific American", "June", 2020); //obj and obj1 same but obj2 different

 

System.out.println(Obj.toString()); //print string of obj

System.out.println(Obj1.toString());//print string of obj1

System.out.println(Obj2.toString());//print string of obj2

 

 

System.out.println(Obj.equals(Obj1)); //obj and obj1 equal and return true

System.out.println(Obj.equals(Obj2)); // obj and obj2 not equal so return false

 

 

}

 

}

Output can be seen below:

You might be interested in
The process of creating a set of instructions that tell a computer how to perform a task is called:
zlopas [31]
It is known as a command
8 0
3 years ago
Everyone holds some stereotypical attitudes.
lozanna [386]
The answer to your question is True.

Everyone holds some type of stereotypical attitudes, whether it's judging someone based on what they wear or how they look everyone has them. 

8 0
3 years ago
Read 2 more answers
Which situations are most likey to use Telehealth
Scilla [17]

Answer:

Emergency situations that make it difficult to go to a clinic will likely require Telehealth. Examples include cases of

1. heart attack

2. breathing difficulties

3. health challenges that begin in the night

4. onset of child labor

5. a pandemic situation where hospitals are filled up

6. sickness among aged people in rural communities with no clinic, etc.

Explanation:

Summarily, the World Health Organization (WHO) defines Telehealth as the 'incorporation of Information Communication Technology in the delivery of health care services in situations where patients and health care providers are separated by distance'. Emergency health situations that make it difficult to quickly access medical help can benefit from Telehealth.

In the cases of a pandemic such as the one experienced in 2020, where hospitals were filled to the brim, telehealth proved to be a useful form of health care delivery.

4 0
3 years ago
What does an animation sequence action do?
OlgaM077 [116]

B) Plays an object's animation

An animation is a single drawing, cartoon, sketch, etc., but a sequence of animations can create movement, which appears to the viewer as the object or subject in motion.

3 0
3 years ago
Read 2 more answers
What does dram stand for?
Sati [7]
Dynamic random-access memory
4 0
3 years ago
Read 2 more answers
Other questions:
  • It is essential that a security professional is able to resolve and respond to cyber law inquiries and incidents while avoiding
    14·1 answer
  • Select the correct answer. Which of these is a function of the marketing team of a game development studio? A. creating art elem
    12·2 answers
  • What does the shell of an operating system do
    14·1 answer
  • Which of the following sentences use the subjunctive mood correctly?Check all that apply. a. Dr. Franklin wishes he were the one
    11·1 answer
  • Which strategy should individuals working in a diverse workplace adopt?
    13·2 answers
  • Create a structure named planet This structure will contain distance from Earth as an integer Atmosphere, language, people and p
    8·1 answer
  • What is administrator access? Multiple Choice refers to how quickly a system can transform to support environmental changes perf
    9·1 answer
  • Not every organization integrates with the Internet, but all use some or most of the technology that gave rise to it.
    15·1 answer
  • I couldn't log in cuz I was banned but here I am with the same username again lol hi
    5·1 answer
  • a) pencil b) ink bottle c) polygon d) eye 3. Under which of the following can an operating system be classified? b) software c)
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!