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
eduard
3 years ago
8

Write a complete method from the client perspective that duplicates each element in place in a ListInterface object. For example

, if the list contained (1, 2, 3), after invoking the method, the list would contains (1, 1, 2, 2, 3, 3). See the tester program for more examples. Notes: For full credit, do not create another list (or any data structure) inside the method. Only modify the parameter list. Not creating another data structure is worth 10 out of the 20 points. This question will not be scored based on efficiency (big-O). The method header is: public static void addDuplicateNeighbors(ListInterface list)
Computers and Technology
1 answer:
Sergio039 [100]3 years ago
8 0

Answer:

The method is the list contains a 3 out of 3, and creating another list would be 20 out of 20 points.

You might be interested in
Carly wants to be able to look at a document without having to use the horizontal scroll bar located on the bottom of the screen
Leno4ka [110]

Answer:

I think it's "Carly will set the page to Page Width, and Rhianna would zoom to 150%." If Carly doesn't want to use the zoom thingy, then she probably would just change the page orentation (idk if I spelled that right). Rhianna wants to zoom in, so that's why I said that. It's either "A" or "C."

Explanation:

I hope this helps!

5 0
3 years ago
The basic building blocks of java is known as<br><br><br><br>Reply fast! plzzzzzzzzzzz!!!
Nadya [2.5K]

Answer:

A class is the basic building block in Java.

8 0
3 years ago
So, I am homeschooled, and I want to watch videos on my school account because I might be waiting for like emails from my teache
Jobisdone [24]

what web browser

if firefox go to addons and see if you can turn off mkaffee or something like that

or go incogneto

plese give me branliest good luck

3 0
3 years ago
Read 2 more answers
Joanna accidentally leaned on her keyboard and repeatedly typed the letter z. How can she fix this mistake?
Brut [27]

Answer:

just press delete

Explanation:

5 0
3 years ago
Read 2 more answers
This is a program that calculates information about orders of shirts and pants. All orders have a quantity and a color. Write a
LuckyWell [14K]

Answer:

Check the explanation

Explanation:

// Clothing.java

public class Clothing {

//Declaring instance variables

private int quantity;

private String color;

//Zero argumented constructor

public Clothing() {

this.quantity = 0;

this.color = "";

}

//Parameterized constructor

public Clothing(int quantity, String color) {

this.quantity = quantity;

this.color = color;

}

// getters and setters

public int getQuantity() {

return quantity;

}

public void setQuantity(int quantity) {

this.quantity = quantity;

}

public String getColor() {

return color;

}

public void setColor(String color) {

this.color = color;

}

public double calculatePrice()

{

return 0.0;

}

}

_____________________________

// Pants.java

public class Pants extends Clothing {

//Declaring instance variables

private int waist;

private int inseam;

//Zero argumented constructor

public Pants() {

this.waist = 0;

this.inseam = 0;

}

//Parameterized constructor

public Pants(int quantity, String color, int waist, int inseam) {

super(quantity, color);

setWaist(waist);

setInseam(inseam);

}

// getters and setters

public int getWaist() {

return waist;

}

public void setWaist(int waist) {

if (waist > 0)

this.waist = waist;

}

public int getInseam() {

return inseam;

}

public void setInseam(int inseam) {

if (inseam > 0)

this.inseam = inseam;

}

public double calculatePrice() {

double tot = 0;

if (waist > 48 || inseam > 36) {

tot = 65.50;

} else {

tot = 50.0;

}

return tot;

}

}

__________________________

// Shirt.java

public class Shirt extends Clothing {

//Declaring instance variables

private String size;

//Zero argumented constructor

public Shirt() {

this.size = "";

}

//Parameterized constructor

public Shirt(int quantity, String color, String size) {

super(quantity, color);

this.size = size;

}

// getters and setters

public String getSize() {

return size;

}

public void setSize(String size) {

this.size = size;

}

public double calculatePrice() {

double tot = 0;

if (size.equalsIgnoreCase("S")) {

tot = getQuantity() * 11.00;

} else if (size.equalsIgnoreCase("M")) {

tot = getQuantity() * 12.50;

} else if (size.equalsIgnoreCase("L")) {

tot = getQuantity() * 15.00;

} else if (size.equalsIgnoreCase("XL")) {

tot = getQuantity() * 16.50;

} else if (size.equalsIgnoreCase("XXL")) {

tot = getQuantity() * 18.50;

}

return tot;

}

}

___________________________

//Test.java

import java.util.ArrayList;

public class Test {

public static void main(String[] args) {

int totShirts=0,totPants=0;

double sprice=0,pprice=0,totWaist=0,totinseam=0,avgWaist=0,avginseam=0;

int cnt=0;

ArrayList<Clothing> clothes=new ArrayList<Clothing>();

Shirt s=new Shirt(8,"Green","XXL");

Pants p1=new Pants(6,"Brown",48,30);

Pants p2=new Pants(4,"Blue",36,34);

clothes.add(s);

clothes.add(p1);

clothes.add(p2);

for(int i=0;i<clothes.size();i++)

{

if(clothes.get(i) instanceof Shirt)

{

Shirt s1=(Shirt)clothes.get(i);

totShirts+=s1.getQuantity();

sprice+=s1.calculatePrice();

}

else if(clothes.get(i) instanceof Pants)

{

Pants pa=(Pants)clothes.get(i);

totPants+=pa.getQuantity();

pprice+=pa.calculatePrice();

totinseam+=pa.getInseam();

totWaist+=pa.getWaist();

cnt++;

}

}

System.out.println("Total number of shirts :"+totShirts);

System.out.println("Total price of Shirts :"+sprice);

System.out.println("Total number of Pants :"+totPants);

System.out.println("Total price of Pants :"+pprice);

System.out.printf("Average waist size is :%.1f\n",totWaist/cnt);

System.out.printf("Average inseam length is :%.1f\n",totinseam/cnt);

 

}

}

_________________________

Output:

Total number of shirts :8

Total price of Shirts :148.0

Total number of Pants :10

Total price of Pants :100.0

Average waist size is :42.0

Average inseam length is :32.0

4 0
3 years ago
Other questions:
  • The type of meter used to test downstream digital signal quality
    12·1 answer
  • How it print media used? ​
    9·1 answer
  • Effective note-taking helps support<br><br> action.<br> distinction.<br> distraction.<br> retention.
    9·2 answers
  • Match the items with their respective descriptions. denotes row numbers denotes cell addresses denotes worksheets denotes column
    10·1 answer
  • Ou are driving in stop-and-go traffic during the daytime, and someone in another vehicle tells you that your brake lights are no
    10·1 answer
  • a paragraph is a segment of text with the same format that begins when you press the enter key and ends when you press enter key
    6·2 answers
  • There are six different sequences for the three approval tasks: check inventory; check credit; check special terms.
    5·1 answer
  • The fill command try’s to fill or generate content for cells based on a ________.
    15·1 answer
  • What is the main purpose of dtp software?
    10·1 answer
  • Which action is applicable only to tables?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!