Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format code with google-java-format #1

Merged
merged 1 commit into from
Sep 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 79 additions & 91 deletions cd.java
Original file line number Diff line number Diff line change
@@ -1,97 +1,85 @@
//the class of a cd object
public class cd
{
//the title of the cd
private String title;
//the artist of the cd
private String artist;
//the number of tracks on the cd
private int tracks;
//the price of the cd
private double price;
//the constructor of the cd class
public cd(String t, String a, int tr, double p)
{
title = t;
artist = a;
tracks = tr;
price = p;
}

//the method to get the title
public String getTitle()
{
return title;
}
//the method to get the artist
public String getArtist()
{
return artist;
}
//the method to get the tracks
public int getTracks()
{
return tracks;
}
//the method to get the price
public double getPrice()
{
return price;
}
//the method to set the title
public void setTitle(String t)
{
title = t;
}
//the method to set the artist
public void setArtist(String a)
{
artist = a;
}
//the method to set the tracks
public void setTracks(int tr)
{
tracks = tr;
}
//the method to set the price
public void setPrice(double p)
{
price = p;
}
//the method to print the cd info
public void print()
{
System.out.println("The title is " + title);
System.out.println("The artist is " + artist);
System.out.println("The number of tracks is " + tracks);
System.out.println("The price is " + price);
System.out.println("________________________________________");

}
// the class of a cd object
public class cd {
// the title of the cd
private String title;
// the artist of the cd
private String artist;
// the number of tracks on the cd
private int tracks;
// the price of the cd
private double price;
// the constructor of the cd class
public cd(String t, String a, int tr, double p) {
title = t;
artist = a;
tracks = tr;
price = p;
}

@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
// the method to get the title
public String getTitle() {
return title;
}
// the method to get the artist
public String getArtist() {
return artist;
}
// the method to get the tracks
public int getTracks() {
return tracks;
}
// the method to get the price
public double getPrice() {
return price;
}
// the method to set the title
public void setTitle(String t) {
title = t;
}
// the method to set the artist
public void setArtist(String a) {
artist = a;
}
// the method to set the tracks
public void setTracks(int tr) {
tracks = tr;
}
// the method to set the price
public void setPrice(double p) {
price = p;
}
// the method to print the cd info
public void print() {
System.out.println("The title is " + title);
System.out.println("The artist is " + artist);
System.out.println("The number of tracks is " + tracks);
System.out.println("The price is " + price);
System.out.println("________________________________________");
}

@Override
public boolean equals(Object obj) {

return super.equals(obj);
}
@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}

@Override
protected void finalize() throws Throwable {
super.finalize();
}
@Override
public boolean equals(Object obj) {

@Override
public int hashCode() {
return super.hashCode();
}
return super.equals(obj);
}

@Override
public String toString() {
return super.toString();
}
@Override
protected void finalize() throws Throwable {
super.finalize();
}

@Override
public int hashCode() {
return super.hashCode();
}

@Override
public String toString() {
return super.toString();
}
}
Loading