1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ipn [44]
3 years ago
10

Questions 5 - 7 refer to the following code: public class Whatchamacallit { private double price; private String title; public W

hatchamacallit() { this (0, "none"); } public Whatchamacallit(double p, String t) { price = 0; if (p > 0) { price = p; } title = t; } public String toString() { return title + " costs $" + price; } } The following code segment appears in another class: ArrayList list = new ArrayList(); list.add(new Whatchamacallit()); list.add(new Whatchamacallit(3.5, "book")); list.add(new Whatchamacallit(-17, "CD")); list.add(new Whatchamacallit(18.95, "sweater")); list.add(new Whatchamacallit(5, "notebook")); /* Missing Code */ Suppose the following line is used to replace /* Missing Code */. System.out.println(list.get(0)); What is printed as a result of executing the code segment?
Computers and Technology
1 answer:
viva [34]3 years ago
3 0
Some code formatting is required to understand this question

<span>Whatchamacallit {
   private double price;
   private String title;
   public Whatchamacallit()
   {
     this (0, "none");
   }
   public Whatchamacallit(double p, String t)
   {
     price = 0;
     if (p > 0)
     {
         price = p;
      }
      title = t;
    }
  public String toString()
   { return title + " costs $" + price; }
}

The following code segment appears in another class:

  ArrayList list = new ArrayList();
  list.add(new Whatchamacallit());
  list.add(new Whatchamacallit(3.5, "book"));
  list.add(new Whatchamacallit(-17, "CD"));
  list.add(new Whatchamacallit(18.95, "sweater"));
   list.add(new Whatchamacallit(5, "notebook"));
  /* Missing Code */
Suppose the following line is used to replace /* Missing Code */. System.out.println(list.get(0)); 

The answer is 'none</span> costs $0'

This is because the line:
'System.out.println(list.get(0))'
gets the first item (index 0) in the array, which was :
'list.add(new Whatchamacallit()) '
and Whatchamacallit() sets price = 0 and title = 'none' in the class Whatchamacallit

The specific output of the  'get(0)' is because of the 'toString()' method in 
Whatchamacallit
 
You might be interested in
JKJKNJJNJJJLKN;K;L;LHNL;BJ
bezimeni [28]

did you have a stroke bestie?

8 0
3 years ago
Read 2 more answers
For a college to take a high school class as an equivalent, what must be in place?a transfer agreementan articulation agreementa
hjlf
An articulation agreement is generally required for a college student to take a high school class as equivalent. In addition, it is a formal argument wherein the two universities are in a partnership that decides the course of action to be done with regards to the transfer policies of the students. 
3 0
3 years ago
Assume a program requires the execution of 50 x 106 FP instructions, 110 x 106 INT instructions, 80 x 106 L/S instructions, and
Molodets [167]

Explanation:

FP - 50 \times 10^6

CPI - 1

INT -110 \times 10^6,

CPI - 1

I/S - 80 \times 10^6 ,

CPI - 4

Branch - 16 \times 10^6

CPI - 2

Clock Speed - 2 \times 10^9

Time(old) =\frac{50 x 10^6 + 110 x 10^6 + 4 x ( 80 x 10^6) + 2 x (16 x 10^ 6)}{2 x 10^9}

Time(old) = 256 \times 10^ {-3}

Time(new) =  \frac{256 \times 10^{-3}}{2}

                = 128 \times 10^{-3}

                =\frac{CPI(new) x [50 x 10^6 + 110 x 10^6 + 4 x ( 80 x 10^6) + 2 x (16 x 10^ 6)]}{2 x 10^9}

                =  128 \times 10^{-3}

CPI(new) = \frac{-206}{50}

               = -4.12

3 0
3 years ago
I will mark you Brainliest if you could guess my birthday.
kipiarov [429]

Answer:

3 ?

i think...

3 0
3 years ago
Read 2 more answers
You receive a request for a report on your office’s productivity. How should you respond to that e-mail?
ki77a [65]

In the case above, the ways that one need to respond to that e-mail is that:

  • Tell the sender that you have received their e-mail and will work on the report.

Check more about email below.

<h3>What is the email about?</h3>

A response email is known to be a kind of an email that is made reply to another email.

Note that In business, this is said to be a type of email that a person will have to write in regards to  inquiry response email, declining an invitation and others.

Hence, In the case above, the ways that one need to respond to that e-mail is that

  • Tell the sender that you have received their e-mail and will work on the report.

Learn more about  e-mail from

brainly.com/question/24688558

#SPJ1

7 0
2 years ago
Other questions:
  • Find meanings for the words and give examples where you can<br><br> WORTH 30 points
    12·1 answer
  • What is one rover that landed on mars but not pathfinder or curosity?
    12·2 answers
  • If images around the edges of a monitor do not look right, the computer might have a(n) access problem. hardware problem. Intern
    13·2 answers
  • Your company leases a very fast internet connection and pays for it based on usage. you have been asked by the company president
    12·1 answer
  • This type of connection uses radio waves to connect devices on a network.A) DataB) EthernetC) RouterD) wifi
    15·1 answer
  • In modern web design, color, font, font size, and style should be declared using:
    5·1 answer
  • Want to network 2 laptops togetger using ethernet cable...But it won't connect
    9·1 answer
  • Write a JAVA program containing a method called hasEight(), which takes an int as input and returns true if the number contains
    14·1 answer
  • Diacuss three examples of divide and conquor approach​
    9·1 answer
  • Government entities may pressure upstream Internet service providers to _____. a. track and monitor the Internet activities of i
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!