Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Questions below use a this drink class public class Drink { private int size, amount; public Drink(int size) { this.size = size; this.amount =

The Questions below use a this drink class

public class Drink { private int size, amount; public Drink(int size) { this.size = size; this.amount = size; } public int sip() { amount; return amount; } public int gulp(int n) { for (int i = 0; i < n; i++) { sip(); } return amount; } public int refill() { amount = size; return amount; } }

QUESTION 13

Choose a sequence of statements that prints 38. Do not include unneeded statements.

Drink drink1 = new Drink(12);

Drink drink1 = new Drink(16);

Drink drink2 = new Drink(32);

Drink drink2 = drink1;

drink1.gulp(2);

drink2.gulp(drink1.sip() / 2);

int r = drink1.sip() + drink2.sip();

System.out.print(r);

5 points

QUESTION 14

Choose a sequence of statements that prints 37. Do not include unneeded statements.

Drink drink1 = new Drink(12);

Drink drink1 = new Drink(16);

Drink drink2 = new Drink(32);

Drink drink2 = drink1;

drink1.gulp(2);

drink2.gulp(drink1.sip() / 2);

int r = drink1.sip() + drink2.sip();

System.out.print(r);

5 points

QUESTION 15

Choose a sequence of statements that prints 36. Do not include unneeded statements.

Drink drink1 = new Drink(12);

Drink drink1 = new Drink(16);

Drink drink2 = new Drink(32);

Drink drink2 = drink1;

drink1.gulp(2);

drink2.gulp(drink1.sip() / 2);

int r = drink1.sip() + drink2.sip();

System.out.print(r);

5 points

QUESTION 16

Choose a sequence of statements that prints 29. Do not include unneeded statements.

Drink drink1 = new Drink(12);

Drink drink1 = new Drink(16);

Drink drink2 = new Drink(32);

Drink drink2 = drink1;

drink1.gulp(2);

drink2.gulp(drink1.sip() / 2);

int r = drink1.sip() + drink2.sip();

System.out.print(r);

5 points

QUESTION 17

Choose a sequence of statements that prints 21. Do not include unneeded statements.

Drink drink1 = new Drink(12);

Drink drink1 = new Drink(16);

Drink drink2 = new Drink(32);

Drink drink2 = drink1;

drink1.gulp(2);

drink2.gulp(drink1.sip() / 2);

int r = drink1.sip() + drink2.sip();

System.out.print(r);

5 points

QUESTION 18

Choose a sequence of statements that prints 11. Do not include unneeded statements.

Drink drink1 = new Drink(12);

Drink drink1 = new Drink(16);

Drink drink2 = new Drink(32);

Drink drink2 = drink1;

drink1.gulp(2);

drink2.gulp(drink1.sip() / 2);

int r = drink1.sip() + drink2.sip();

System.out.print(r);

5 points

QUESTION 19

Choose a sequence of statements that prints 9. Do not include unneeded statements.

Drink drink1 = new Drink(12);

Drink drink1 = new Drink(16);

Drink drink2 = new Drink(32);

Drink drink2 = drink1;

drink1.gulp(2);

drink2.gulp(drink1.sip() / 2);

int r = drink1.sip() + drink2.sip();

System.out.print(r);

5 points

QUESTION 20

Choose a sequence of statements that prints 7. Do not include unneeded statements.

Drink drink1 = new Drink(12);

Drink drink1 = new Drink(16);

Drink drink2 = new Drink(32);

Drink drink2 = drink1;

drink1.gulp(2);

drink2.gulp(drink1.sip() / 2);

int r = drink1.sip() + drink2.sip();

System.out.print(r);

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

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago