Questions 5 - 7 refer to the following code:
public class Whatchamacallit {
privat...
![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 23.04.2020 03:31 khikhi1705
Questions 5 - 7 refer to the following code:
public class 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(list. size() - 1));
What is printed as a result of executing the code segment?
notebook costs $5.0
CD costs $0.0
book costs $3.5
sweater costs $18.95
none costs $0.0
2nd part of question
Suppose the following lines are used to replace /* Missing Code */.
list. remove(1);
System. out. println(list. get(1));
What is printed as a result of executing the code segment?
none costs $0.0
book costs $3.5
sweater costs $18.95
CD costs $0.0
notebook costs $5.0
![ansver](/tpl/images/cats/User.png)
Answers: 3
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 02:00
Aletter or menu command that starts an action when the user presses the designated letter and the alt key together is called what?
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 10:40
When running anti-virus software , what could be a reason where recipitent is not guaranteed that data being streamed will not get interrupted?
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 11:00
When building customer relationships through email what should you not do? question 2 options: utilize proper grammar, spelling, and punctuation type in all capital letters use hyperlinks rather than attachments respond to all emails within 24 hours
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 21:50
Given int variables k and total that have already been declared, use a while loop to compute the sum of the squares of the first 50 counting numbers, and store this value in total. thus your code should put 11 + 22 + 33 + + 4949 + 50*50 into total. use no variables other than k and total.
Answers: 2
You know the right answer?
Questions
![question](/tpl/images/cats/mat.png)
Mathematics, 02.04.2020 01:12
![question](/tpl/images/cats/mat.png)
Mathematics, 02.04.2020 01:12
![question](/tpl/images/cats/mkx.png)
Arts, 02.04.2020 01:12
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 02.04.2020 01:12
![question](/tpl/images/cats/mat.png)
Mathematics, 02.04.2020 01:12
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/biologiya.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 02.04.2020 01:12
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/obshestvoznanie.png)
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/fizika.png)
![question](/tpl/images/cats/ekonomika.png)
![question](/tpl/images/cats/ekonomika.png)
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/fizika.png)
![question](/tpl/images/cats/istoriya.png)
History, 02.04.2020 01:12