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
zhannawk [14.2K]
3 years ago
7

The Toy class is started below. Write three constructors for this class as explained in the comments below.

Computers and Technology
1 answer:
Kay [80]3 years ago
4 0

Answer:

Following are the solution to this question:

Explanation:

For question 1:

public class Toy//defining a class

{        private String toyName;//defining String variable

       private String toyMaker;//defining String variable

       private double toyCost;//defining double variable

       Toy() //defining default constructor Toy

       {

       }

       Toy(String aToyName, String aToyMaker)// defining parameterized constructor that accepts two String parameters

       {

       }

       Toy(String aToyName, String aToyMaker, double aToyCost)// defining parameterized constructor that accepts three parameters  

       {

       }

}

For question 2:

public class Song//defining a class Song

{

private String title;//defining String variable

private String artist;//defining String variable

private int trackMinutes;//defining integer variable

private int trackSeconds;//defining integer variable

Song() //defining default constructor

{

title = artist = "";//use String variable that holds null value

trackMinutes = trackSeconds = 0;//use integer variable that hold a value  

}

Song(String title)//use parameterized constructor that holds one parameter  

{

this.title = title;// use this keyword to hold title value

artist = "";// //hold value in String variable

trackMinutes = 0;//hold value in integer variable

trackSeconds = 0;//hold value in integer variable

}

Song(String t, String a) //use parameterized constructor that holds two String parameter

{

title=t; //hold value in String variable

artist=a;//hold value in String variable

trackMinutes = trackSeconds = 0;  //hold value in integer variable

}

Song(String t, String a, int min, int sec) //use parameterized constructor that takes 2 String and 2 integer parameters

{

title = t;//hold value in integer variable

artist = a;//hold value in String variable

trackMinutes = min;  //hold value in integer variable

trackSeconds = sec;   //hold value in integer variable

}

}

In the question 1, three constructor is declared, in which one is default and two is parameterized, that accepts two string parameter and two string and one double parameter.

In the question 2, four constructor is declared, in which one is default and three is parameterized, that accepts one, two, and four parameter.

You might be interested in
Choose ALL guidelines listed below pertaining to fair use.
tino4ka555 [31]

Answer:

Introduction

As you write blog posts, you may find that you want to include images you find online. Or maybe you found a great piece of writing—a recipe, a story, or a review—that you want to highlight on your own blog. It's important to know that almost all of the content you find on the Web belongs to someone. Just because you can take images, text, and more from other sites doesn't mean it's right to do so—ethically or legally.

In this lesson, you'll learn about the copyright protections that apply to work posted online. You'll learn about the rules that determine which images and text you can use, and how you can use them. You'll also learn how to protect the content you create.

The laws discussed in this lesson are United States laws. No lawyer was involved in preparing this lesson. We are not legal experts, and this lesson should not be taken as legal advice.

Understanding copyright

Copyright is the legal concept that works—art, writing, images, music, and more—belong to the people who create them. According to copyright law, any original content you create and record in a lasting form is your own intellectual property. This means other people can't legally copy your work and pretend it's their own. They can't make money from the things you create either.

To use, copy, or change a copyrighted work, you need permission from the person who holds the copyright. This permission is called a license. Even though everyone has the right to require that others respect their copyright and ask permission to use their work, some people and organizations choose to license their content more freely. They do this by giving their work a Creative Commons license or by placing their work in the Public Domain.

6 0
3 years ago
Read 2 more answers
Input an int between 0 and 100 and print the numbers between it and 100, including the number itself and the number 100. If the
Murrr4er [49]

import java.util.Scanner;

public class JavaApplication42 {

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       int count = 0;

       System.out.println("Enter an integer between 0 and 100");

       int num = scan.nextInt();

       if (num <= 0 || num >= 100){

           System.out.println("error");

       }

       else{

           while(num <= 100){

               if (count == 20){

                   System.out.println("");

                   count = 0;

               }

               else{

                   System.out.print(num+" ");

                   count++;

                   num++;

               }

           }

       }

   }

   

}

I hope this helps!

6 0
3 years ago
Sharon has multiple tables in her database. she wants to view related records in those tables. what should sharon do to view the
den301095 [7]

according to plato she should create relationships between the tables

3 0
3 years ago
Hola, disculpa me podrías ayudar enviándome una captura dándole like a este video? Por favor, es un proyecto escolar en el que e
PtichkaEL [24]

Answer:

Una captura de pantalla es una instantánea de la pantalla de un dispositivo informático, como un teléfono o una computadora. Mantenga presionado el botón de encendido y el botón de columna hacia abajo para tomar una captura de pantalla en teléfonos inteligentes.

Explanation:

Una captura de pantalla de la pantalla de un dispositivo de computadora es como tomar la foto de una pantalla. Para los teléfonos inteligentes, presionar la columna hacia abajo y el botón de encendido tomaría la instantánea del teléfono.

Para darle Me gusta a un video en una plataforma de redes sociales, simplemente haga clic en el ícono de pulgar hacia arriba.

6 0
3 years ago
Ok so this isn’t really a question that is for school but...
Nastasia [14]

Answer:

u shoud just keep it ;-;

Explanation:

5 0
3 years ago
Other questions:
  • Which of the following is not a standard method called as partof the JSP life cycle?
    5·1 answer
  • When an attacker uses bluetooth to copy e-mails, contact lists, or other files on the device, it is called?
    12·1 answer
  • Ruby is creating a presentation. She wants each slide displayed at intervals of five seconds. Which feature in the presentation
    6·2 answers
  • Write a class called Counter that represents a simple tally counter, which might be used to count people as they enter a room. T
    9·1 answer
  • The ash and dust from a volcanic eruption can cause a _______ change in the environment.
    13·1 answer
  • Imagine that you have configured the enable secret command, followed by the enable password command, from the console. You log o
    9·1 answer
  • Which two statements are true about the Data Sync functionality? (Choose two.)
    15·1 answer
  • The Role of Computer
    15·1 answer
  • Task 1 (25 points): In database [your Pitt username], create the following entity tables: movies actors locations Each tables lo
    7·1 answer
  • Why do you think it is important to know typography and color when designing web sites?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!