Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

package junit _ testing _ Jtorres 1 2 6 3 import static org.junit.Assert. public class ProductTest l etest public void testpriceVar ( ) { Product

package junit_testing_Jtorres1263
import static org.junit.Assert.
public class ProductTest l
etest
public void testpriceVar(){
Product prod = new Product ("Dr. Pepper", 1.25) ;
double expected =1.25;
double actual a prod.getprodprice()s
}
assertequals(expected, actual, 0);
@test
public void testpriceVarForLessThanZero(){
Product prod = new Product ("Dr. Pepper", -1.99) ;
double expected =0.25;
double actual = prodogetprodprice( private 8:cdots is prodivames
private double prodprice;
private int prodQtys
public Product(String prodName, double prodprice) constructor
}
this.prodName e prodName;
}
this.prodPrice o prodPrices
public product() f //no angs constructor
}
public static void main(String[] args){
Product pl= new Product();
p1.setprodPrice (-20);
}
System,out.printin(p1.getProdPrice());
public String getProdName(){
}
return prodName;
public void setProdName(String prodName){
}
this. prodName = prodNames
public double getProdPrice(){
}
return prodprices
public void setProdPrice(double prodPrice){
if (prodPrice o){
3
this oprodprice =0.25g
else {
}
this oprodprice = prodprices
}
public int getprodety(){
}
return prodetys
pubitic void setprodety (int prodety) f
}
this prodQty = prodQtys
public string tostring() f
}
return this-getprodlame()+", "this. getProdPrice();
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions