subject

The Toy class is started below. Write three constructors for this class as explained in the comments below. public class Toy
{
private String toyName;
private String toyMaker;
private double toyCost;
//default constructor
//constructor which has two String parameters
// constructor with three parameters
}
2. The Song class is provided below, but the constructors contain errors. Read the comments to determine the number of errors, then find the errors. Each line of code can have zero, one, or more than one errors. If a line of code contains errors, rewrite it correctly to the right.
public class Song
{
private String title;
private String artist;
private int trackMinutes;
private int trackSeconds;
// default constructor contains 2 errors
public void Song
{
title = artist = "";
trackMinutes = trackSeconds = 0.0;
}
// 1-arg constructor contains 5 errors
public song( title)
{
title = title;
artist = 0;
trackMinutes = "";
trackSecond = 0;
}
// 2-arg constructor contains 3 errors
public Song(String t, a)
{
t = title;
a = artist;
trackMinutes = trackSeconds = 0;
}
//4-arg constructor contains 4 errors
private Song(String t, String a, int min, int sec);
{
title = t;
artist = art;
trackMin = min;
trackSec = sec;
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:30
Consider the following statements: #include #include class temporary { private: string description; double first; double second; public: temporary(string = "", double = 0.0, double = 0.0); void set(string, double, double); double manipulate(); void get(string& , double& , double& ); void setdescription(string); void setfirst(double); void setsecond(double); }; write the definition of the member function set() so that the instance variables are set according to the parameters. write the definition of the constructor so that it initializes the instance variables using the function set() write the definition of the member function manipulate() that returns a decimal number (double) as follows: if the value of description is "rectangle", it returns first * second if the value of description is "circle" it returns the area of a circle with radius first if the value of description is "cylinder" it returns the volume of a cylinder with radius first and height second. hint: the volume of a cylinder is simply the area of the circle at the base times the height. if the value of description is "sphere" it returns the volume of the sphere with radius first. otherwise it returns -1.0;
Answers: 1
question
Computers and Technology, 22.06.2019 11:10
Which are not examples of chronic or persistent stress? moving
Answers: 1
question
Computers and Technology, 24.06.2019 08:30
Aconsumer would pay an extra they used the rent to own program to buy the computer, rather than using cash. for all of the items, is the cheapest option over the life of the contract. the most expensive overall option is to use purchase the item.
Answers: 2
question
Computers and Technology, 24.06.2019 15:40
In the above figure, what type of cylinder arrangement is shown in the figure above? a. l-type b. v-type c. in-line d. horizontal pls make sure its right if its rong im grounded for 3months
Answers: 1
You know the right answer?
The Toy class is started below. Write three constructors for this class as explained in the comments...
Questions
question
Biology, 25.10.2019 19:43
Questions on the website: 13722360