@lest public void test_0_20) { Toy t1 = new Toy(1000123, "Colouring Book", 3, 9.99); +1.setToyID(1000854); t1.setToyName("Teddy Bear"); t1.setToyQuantity(4); 11.setToyPrice(19.80); int toyID=t1.getToyID(); String toyName = t1.getToyName(); int toyQty = t1.getToyQuantity(); double toyPrice = t1.getToyPrice(); String toyInfo = t1.getToy Information(); int expToyID=1000854; int expToyQty = 4; double expToyPrice = 19.8; String expToyName = "Teddy Bear"; String expToyInfo = "Toy(1000854, Teddy Bear), quantity(4) with $( 19.80)/toy"; String errorMsg1 = String.format("\n Test set ToyID failed. Returned (%d) " + "but correct is (%d)", toyID, expToyID); assertEquals(errorMsg1, expToyID, toyID); String errorMsg2 = String.format("\n Test set ToyName failed. Returned (%s) " + "but correct is (%s)", toyName, correct is (%d)". expToyName); assertEquals(errorMsg2, expToyName, toyName); String errorMsg3 = String.format("\n Test set ToyQuantity failed. Returned (%d) " + "but toyQty, expToyQty); assertEquals(errorMsg3, expToyQty, toyQty); String errorMsg4 = String.format("\n Test set ToyPrice failed. Returned (%6.2f) " + "but correct is (%6.21)", toyPrice, expToy Price); final double THRESHOLD = .01; assertTrue(errorMsg4, Math.abs(expToyPrice-toyPrice) < THRESHOLD); String errorMsg5 = String.format("\n Test get ToyInformation failed. Returned (%s)" + "but correct is (%s)", toyInfo, expToy Info); assertEquals(errorMsg5, expToyInfo, toyInfo); } public void test_0_1() { Toy t1 = new Toy(1000123, "Colouring Book", 3, 9.99); t1.setToyID(1000127); t1.setToyName("SpongeBob DVD"); t1.setToyQuantity(8); t1.setToyPrice(29.98); int toyID = t1.getToyID(); String toyName = t1.getToyName(); int toyQty = t1.getToyQuantity(); double toyPrice = t1.getToyPrice(); String toyInfo = t1.getToy Information(); int expToyID = 1000127; int expToyQty = 8; double expToyPrice = 29.98; String expToyName = "SpongeBob DVD"; String expToyInfo = "Toy(1000127, SpongeBob DVD), quantity(8) with $( 29.98)/toy"; String errorMsg1 = String.format("\n Test set ToyID failed. Returned (%d) " + "but correct is (%d)", toyID, expToyID); assertEquals(errorMsg1, expToyID, toyID); String errorMsg2 = String.format("\n Test setToyName failed. Returned (%s) " + "but correct is (%s)", toyName, correct is (%d)", expToyName); assertEquals(errorMsg2, expToyName, toyName); String errorMsg3 = String.format("\n Test set ToyQuantity failed. Returned (%d) " + "but toyQty, expToyQty); assertEquals(errorMsg3, expToyQty, toyQty); String errorMsg4 = String.format("\n Test set Toy Price failed. Returned (%6.2f) " + "but correct is (%6.2f)", toyPrice, expToy Price); final double THRESHOLD = .01; assertTrue(errorMsg4, Math.abs(expToy Price - toyPrice) < THRESHOLD); String errorMsg5 = String.format("\n Test getToyInformation failed. Returned (%s) " + "but correct is (%s)", toyInfo, expToyInfo); assertEquals(errorMsg5, expToy Info, toyInfo); }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please help me with this. I am having trouble. Create a java that corresponds / follows the test cases:

public void test_0_0() {

Toyt1=newToy(1000121,"Red Bike",1,89.99);

inttoyID=t1.getToyID();

StringtoyName=t1.getToyName();

inttoyQty=t1.getToyQuantity();

doubletoyPrice=t1.getToyPrice();

StringtoyInfo=t1.getToyInformation();

intexpToyID=1000121;

intexpToyQty=1;

doubleexpToyPrice=89.99;

StringexpToyName="Red Bike";

StringexpToyInfo="Toy(1000121,Red Bike), quantity(1) with $( 89.99)/toy";

StringerrorMsg1=String.format("\n Test getToyID failed. Returned (%d) " + "but correct is  (%d)", toyID,

expToyID);

assertEquals(errorMsg1, expToyID, toyID);

StringerrorMsg2=String.format("\n Test getToyName failed. Returned (%s) " + "but correct is  (%s)", toyName,

expToyName);

assertEquals(errorMsg2, expToyName, toyName);

StringerrorMsg3=String.format("\n Test getToyQuantity failed. Returned (%d) " + "but correct is  (%d)",

toyQty,expToyQty);

assertEquals(errorMsg3, expToyQty, toyQty);

StringerrorMsg4=String.format("\n Test getToyPrice failed. Returned (%6.2f) " + "but correct is  (%6.2f)",

toyPrice,expToyPrice);

finaldoubleTHRESHOLD=.01;

assertTrue(errorMsg4, Math.abs(expToyPrice - toyPrice) < THRESHOLD);

StringerrorMsg5=String.format("\n Test getToyInformation failed. Returned (%s) " + "but correct is  (%s)",

toyInfo,expToyInfo);

assertEquals(errorMsg5, expToyInfo, toyInfo);

}

 

***The other two test cases are in the images below**

Thank you

@lest
public void test_0_20) {
Toy t1 = new Toy(1000123, "Colouring Book", 3, 9.99);
+1.setToyID(1000854);
t1.setToyName("Teddy Bear");
t1.setToyQuantity(4);
11.setToyPrice(19.80);
int toyID=t1.getToyID();
String toyName = t1.getToyName();
int toyQty = t1.getToyQuantity();
double toyPrice = t1.getToyPrice();
String toyInfo = t1.getToy Information();
int expToyID=1000854;
int expToyQty = 4;
double expToyPrice = 19.8;
String expToyName = "Teddy Bear";
String expToyInfo = "Toy(1000854, Teddy Bear), quantity(4) with $( 19.80)/toy";
String errorMsg1 = String.format("\n Test set ToyID failed. Returned (%d) " + "but
correct is (%d)", toyID,
expToyID);
assertEquals(errorMsg1, expToyID, toyID);
String errorMsg2 = String.format("\n Test set ToyName failed. Returned (%s) " + "but
correct is (%s)", toyName,
correct is (%d)".
expToyName);
assertEquals(errorMsg2, expToyName, toyName);
String errorMsg3 = String.format("\n Test set ToyQuantity failed. Returned (%d) " + "but
toyQty, expToyQty);
assertEquals(errorMsg3, expToyQty, toyQty);
String errorMsg4 = String.format("\n Test set ToyPrice failed. Returned (%6.2f) " + "but
correct is (%6.21)",
toyPrice, expToy Price);
final double THRESHOLD = .01;
assertTrue(errorMsg4, Math.abs(expToyPrice-toyPrice) < THRESHOLD);
String errorMsg5 = String.format("\n Test get ToyInformation failed. Returned (%s)" +
"but correct is (%s)",
toyInfo, expToy Info);
assertEquals(errorMsg5, expToyInfo, toyInfo);
}
Transcribed Image Text:@lest public void test_0_20) { Toy t1 = new Toy(1000123, "Colouring Book", 3, 9.99); +1.setToyID(1000854); t1.setToyName("Teddy Bear"); t1.setToyQuantity(4); 11.setToyPrice(19.80); int toyID=t1.getToyID(); String toyName = t1.getToyName(); int toyQty = t1.getToyQuantity(); double toyPrice = t1.getToyPrice(); String toyInfo = t1.getToy Information(); int expToyID=1000854; int expToyQty = 4; double expToyPrice = 19.8; String expToyName = "Teddy Bear"; String expToyInfo = "Toy(1000854, Teddy Bear), quantity(4) with $( 19.80)/toy"; String errorMsg1 = String.format("\n Test set ToyID failed. Returned (%d) " + "but correct is (%d)", toyID, expToyID); assertEquals(errorMsg1, expToyID, toyID); String errorMsg2 = String.format("\n Test set ToyName failed. Returned (%s) " + "but correct is (%s)", toyName, correct is (%d)". expToyName); assertEquals(errorMsg2, expToyName, toyName); String errorMsg3 = String.format("\n Test set ToyQuantity failed. Returned (%d) " + "but toyQty, expToyQty); assertEquals(errorMsg3, expToyQty, toyQty); String errorMsg4 = String.format("\n Test set ToyPrice failed. Returned (%6.2f) " + "but correct is (%6.21)", toyPrice, expToy Price); final double THRESHOLD = .01; assertTrue(errorMsg4, Math.abs(expToyPrice-toyPrice) < THRESHOLD); String errorMsg5 = String.format("\n Test get ToyInformation failed. Returned (%s)" + "but correct is (%s)", toyInfo, expToy Info); assertEquals(errorMsg5, expToyInfo, toyInfo); }
public void test_0_1() {
Toy t1 = new Toy(1000123, "Colouring Book", 3, 9.99);
t1.setToyID(1000127);
t1.setToyName("SpongeBob DVD");
t1.setToyQuantity(8);
t1.setToyPrice(29.98);
int toyID = t1.getToyID();
String toyName = t1.getToyName();
int toyQty = t1.getToyQuantity();
double toyPrice = t1.getToyPrice();
String toyInfo = t1.getToy Information();
int expToyID = 1000127;
int expToyQty = 8;
double expToyPrice = 29.98;
String expToyName = "SpongeBob DVD";
String expToyInfo = "Toy(1000127, SpongeBob DVD), quantity(8) with $( 29.98)/toy";
String errorMsg1 = String.format("\n Test set ToyID failed. Returned (%d) " + "but
correct is (%d)", toyID,
expToyID);
assertEquals(errorMsg1, expToyID, toyID);
String errorMsg2 = String.format("\n Test setToyName failed. Returned (%s) " + "but
correct is (%s)", toyName,
correct is (%d)",
expToyName);
assertEquals(errorMsg2, expToyName, toyName);
String errorMsg3 = String.format("\n Test set ToyQuantity failed. Returned (%d) " + "but
toyQty, expToyQty);
assertEquals(errorMsg3, expToyQty, toyQty);
String errorMsg4 = String.format("\n Test set Toy Price failed. Returned (%6.2f) " + "but
correct is (%6.2f)",
toyPrice, expToy Price);
final double THRESHOLD = .01;
assertTrue(errorMsg4, Math.abs(expToy Price - toyPrice) < THRESHOLD);
String errorMsg5 = String.format("\n Test getToyInformation failed. Returned (%s) " +
"but correct is (%s)",
toyInfo, expToyInfo);
assertEquals(errorMsg5, expToy Info, toyInfo);
}
Transcribed Image Text:public void test_0_1() { Toy t1 = new Toy(1000123, "Colouring Book", 3, 9.99); t1.setToyID(1000127); t1.setToyName("SpongeBob DVD"); t1.setToyQuantity(8); t1.setToyPrice(29.98); int toyID = t1.getToyID(); String toyName = t1.getToyName(); int toyQty = t1.getToyQuantity(); double toyPrice = t1.getToyPrice(); String toyInfo = t1.getToy Information(); int expToyID = 1000127; int expToyQty = 8; double expToyPrice = 29.98; String expToyName = "SpongeBob DVD"; String expToyInfo = "Toy(1000127, SpongeBob DVD), quantity(8) with $( 29.98)/toy"; String errorMsg1 = String.format("\n Test set ToyID failed. Returned (%d) " + "but correct is (%d)", toyID, expToyID); assertEquals(errorMsg1, expToyID, toyID); String errorMsg2 = String.format("\n Test setToyName failed. Returned (%s) " + "but correct is (%s)", toyName, correct is (%d)", expToyName); assertEquals(errorMsg2, expToyName, toyName); String errorMsg3 = String.format("\n Test set ToyQuantity failed. Returned (%d) " + "but toyQty, expToyQty); assertEquals(errorMsg3, expToyQty, toyQty); String errorMsg4 = String.format("\n Test set Toy Price failed. Returned (%6.2f) " + "but correct is (%6.2f)", toyPrice, expToy Price); final double THRESHOLD = .01; assertTrue(errorMsg4, Math.abs(expToy Price - toyPrice) < THRESHOLD); String errorMsg5 = String.format("\n Test getToyInformation failed. Returned (%s) " + "but correct is (%s)", toyInfo, expToyInfo); assertEquals(errorMsg5, expToy Info, toyInfo); }
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education