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
Distinguish between weighted codes and non weighted codes​
Gnom [1K]

Answer:

In weighted codes, each digit is a assigned a specific weight according to its position. NON- WEIGHTED CODE - The Non - Weighted Code are not positionally weighted. In other words, codes that are not assigned with any weight to each digit position. Hope it helpful U.

8 0
3 years ago
Which expansion slot is best for high-end dedicated video cards?
Contact [7]

Solution:

It is done Motherboard.

The motherboard includes most of the slots that we'll run into these days. It's a little unusual in that we don't often see motherboards which have both PCI-Express slots and an AGP slot. The best slot to use for video cards is the PCI-Express x16 slot. The next best is the AGP slot. The next best is a PCI-Express x1 slot but video cards which fit that slot are very hard to find as of late 2006. Some low-budget computers are sold with integrated video and have neither PCI-Express x16 slot or an AGP slot.

3 0
4 years ago
Write a program whose input is two integers and whose output is the two integers swapped.
Tpy6a [65]

Answer:

The program to this question can be given as:

Program:

#include <iostream>  //header file

using namespace std;   //using namespace.

void SwapValues(int* userVal1, int* userVal2); //function declaration.

void SwapValues(int* userVal1, int* userVal2) //function definition.

{ //function body.

//perform swapping

   int t = *userVal1;  

   *userVal1 = *userVal2;

   *userVal2 = t;

}

int main() //main method  

{

int n1, n2; //define variable

cout<<"Enter first number :"; //message

cin>>n1; //input by user.

cout<<"Enter second number :"; //message  

cin>>n2; //input by user.

SwapValues(&n1,&n2); //calling function.

cout<<"Swapped values"<<endl;

cout<<"first number is :"<<n1<<endl; //print value

cout<<"second number is:"<<n2<<endl; //print value

return 0;

}

Output:

Enter first number :3

Enter second number :8

Swapped values

first number is :8

second number is :3

Explanation:

The description of the above C++ language program can be given as:

  • In the program, firstly we include the header file. Then we declare and define a function that is "SwapValues()" function in the function we pass two integer variable that is "userVal1 and userVal2" inside a function, we define an integer variable that is "t" and perform swapping.  
  • Then we define the main function in the main function we define two variables that is "n1 and n2" this variable is used to take value-form user. then we pass this value to function and print the function values.

5 0
3 years ago
Data ________ is important because it establishes an organization's rules for sharing, disseminating, acquiring, standardizing,
photoshop1234 [79]

Data protection policy is important because it establishes an organization's rules for acquiring, standardizing and disseminating data.

<h3>What is Data protection policy?</h3>

These are policies adopted by organizations that help to ensure data is adequately protected.

When data isn't protected , it could get to the hands of criminals which could use it for different types of cybercrime and also to ensure compliance with data protection laws in the country.

Read more about Data protection policy here brainly.com/question/26493645

3 0
2 years ago
Por que se dice que las TIC´S son las integracion de las TI y las TC?
Katena32 [7]

La respuesta correcta para esta pregunta abierta es la siguiente.

A pesar de que no se anexan opciones o incisos para responder, podemos comentar lo siguiente.

Se dice que las TIC´S son las integración de las TI y las TC porque ambas actividades se han integrado o fusionado en una solo concepto al momento de juntar las herramientas tecnológicas para almacenar, procesar y mandar información a través de los recursos tecnológicos utilizando los canales o recursos de los medios masivas de comunicación como lo son las redes satelitales o las comunicaciones vía microondas.

Al fusionarse las TI (Tecnologías de la Información) con las TC (Tecnologías de Comunicación), se maximiza la capacidad de enviar una mayor cantidad de información al momento a diferentes lugares del planeta.

4 0
3 years ago
Other questions:
  • Which computer device is used to capture or copy a photograph to place in a report?
    14·1 answer
  • When you first launch the internet, what page will open?
    9·1 answer
  • Which wireless device connects multiple laptops, tablets, phones, and other mobile devices in a corporate environment?
    13·1 answer
  • What is unique address in ICT​
    11·1 answer
  • Which option should you select to ignore all tracked changes in a document? To ignore all tracked changes in a document, you sho
    14·1 answer
  • The ability to understand a person's needs or intentions in the workplace is demonstrating
    5·1 answer
  • PLEASE HELP!!<br> giving loads of points<br> create the python codes for the images
    5·1 answer
  • Can someone help me with this question, i know all except psuedocode, help me please
    6·1 answer
  • Select the three subjects studied in sports biomechanics.
    9·1 answer
  • Interactivity and Blank______ are two important capabilities of the Internet in the Blank______ relationship.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!