100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Unionville Hs AP COMP SCI 11 Chapter 4 Programming Projects $11.99   Add to cart

Exam (elaborations)

Unionville Hs AP COMP SCI 11 Chapter 4 Programming Projects

 1 view  0 purchase
  • Course
  • Institution

Counter public class project1 { int count; public project1 (){ count = 0; } public void click() { count++; }p ublic int getpublic1() { return count; }p ublic int reset() { count = 0; return count; } } C ountertest public class project1part2 { public static void main(String[] ar...

[Show more]

Preview 3 out of 25  pages

  • July 4, 2021
  • 25
  • 2020/2021
  • Exam (elaborations)
  • Questions & answers
  • Secondary school
  • 2
avatar-seller
Counter



public class project1 {

int count;

public project1 (){
count = 0;
}
public void click() {

count++;
}
public int getpublic1()
{
return count;
}
public int reset()
{
count = 0;
return count;

}

}




Countertest



public class project1part2 {

public static void main(String[] args) {

project1 classcount1 = new project1();
project1 classcount2 = new project1();

classcount1.click();
classcount1.click();
classcount2.click();
int sum = classcount1.getpublic1() + classcount2.getpublic1();

, System.out.println("The count after click is " + sum);
classcount1.reset();
classcount2.reset();
sum = classcount1.getpublic1() + classcount2.getpublic1();
System.out.println("The count after the reset is " + sum);




}

}




bulb



public class Bulb {

String light;

public Bulb() {
light = "off";
}



public String TurnOn()
{
light = new String("on");
return light;
}

public String TurnOff()
{
light = new String("off");
return light;
}

}

, Lights



public class BulbPart2 {



public static void main(String [] args) {

Bulb bulb1 = new Bulb();
Bulb bulb2 = new Bulb();



String bulb3 = bulb1.TurnOff();
String bulb4 = bulb2.TurnOff();
System.out.println("Bulb one is "+bulb3);
System.out.println("Bulb two is "+bulb4);

bulb3 = bulb1.TurnOn();
bulb4 = bulb2.TurnOff();
System.out.println("Bulb one is "+bulb3);
System.out.println("Bulb two is "+bulb4);

bulb4 = bulb2.TurnOn();
System.out.println("Bulb one is "+bulb3);
System.out.println("Bulb two is "+bulb4);

bulb1.TurnOff();
System.out.println(bulb1.toString());

}
}




Sphere



public class Sphere {

double diameter;
double volume;
double surfacearea;

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Examhack. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $11.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

80189 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$11.99
  • (0)
  Add to cart