Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( v ) public int modelCount ( String aModel ) { int count = 0 ; for ( int i = 0 ; i refrigerators.length;

(v)
public int modelCount(String aModel){
int count =0;
for (int i=0;i refrigerators.length; i++)
if (refrigerators[i].getModel().equals(aModel))
count++;
return count;
}
(vi)
public Refrigerator[] smallRefrigerators(){
int min=0;
int min2=0;
for (int i=1;i refrigerators.length; i++)
if (refrigerators[i].getCapacity() refrigerators[min].getCapacity()){
min2=min;min=i;
}
else if (refrigerators[i].getCapacity() refrigerators[min2].getCapacity()||min==min2)
min2=i;
Refrigerator [] smallRefrigerators = new Refrigerator[2];
smallRefrigerators [0]= refrigerators min;
smallRefrigerators 1= refrigerators [min2];
return smallRefrigerators;
}
(vii)
public class TestRefrigeratorShop {
public static void main(String[] args){
Refrigerator [] refrigerators new Refrigerator("RM2018",300),
new Refrigerator("RM3718",600),
new Refrigerator("RM1033",200)};
RefrigeratorShop myRefrigeratorShop = new RefrigeratorShop(refrigerators);
myRefrigeratorShop. displayRefrigerator(2);
System.out.println("No. of 'RM1033' refrigerator: "+
myRefrigeratorShop.modelCount("Slope Arm"));
Refrigerator [] smallRefrigerators = myRefrigeratorShop.smallRefrigerators();
System.out.println("Smallest refrigerators ;
for (int i=0;i smallRefrigerators.length; i++)
System.out.println(" Model : "+smallRefrigerators[i].getModel()+","+
" Capacity: "+smallRefrigerators[i].getCapacity());
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

Understanding Databases Concepts And Practice

Authors: Suzanne W Dietrich

1st Edition

1119827949, 9781119827948

More Books

Students also viewed these Databases questions

Question

=+What kind of question would you ask to encourage their response?

Answered: 1 week ago

Question

=+Does it keep the visitor reading?

Answered: 1 week ago