Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using the IST Linux system create the following Java command line Data Structure

ID: 3873670 • Letter: U

Question

Using the IST Linux system create the following Java command line Data Structures application Lab6.java on Linux or IntelliJ

Declare an enumeration named cars and add five different types.

Print each car out using iteration (loop)

Declare a BitSet named flags, add five bits, set each bit using a for statement.

Print each flag value out using iteration (loop)

Declare a vector named collection and add three different types: integers, double, float

Print each collection value out using iteration (loop)

Declare a stack named processes, push and pop five values on the stack

Print each processes value out using iteration (loop)

Declare a map named products, put five values in the map

Print each products value out using iteration (loop)

Declare a hashtable named customers, put five values in the hashtable

Print each customer value out using iteration (loop)

Previous

Enumeration Of Cars. Acura Audi Buick BMW Chevy Dodge Ford Bitset of Flags Inital pattern in bits1: 10, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 Initial pattern in bits2: 11, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24, 26, 27, 28, 29, 31 Initial pattern in bits3: 10, 4, 8, 12, 16, 20, 24, 28 Initial pattern in bits4: 11, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31) Initial pattern in bits5: Vector collection. Initial size:8 Capacity after addition of integer:8 Current capacity after addition of double:8 Current capacity after addition of float:8 First element: 10 Last element: 100 10 22.55 46.79 100 Stack: [ Stack: [75, 100, 125, 150, 175] pop -> Stack: [75, 100, 125, 150] pop -> Stack: [75, 100, 125] pop -> Stack: [75, 100] pop -> Stack: [75] pop -> Stack: [] pop -> Empty Stack Number of Products Map products: fYork-5, Twix-7, Hershey' s-13, Reese's-9, M&M;' s-16 Number Of Hershey's: 13 Number Of M&M;'s: 16 Number Of Reese's: 9 Number Of York: 5 Number Of Twix: 7 Customers purchases Mike: 888.88 Larry: 1133.53 Jason: 500.0 Kirk: 4499.55 Paul: 79.95 Jason has a $50 coupon for a purchase made over $400 Jason 's new total 450.0

Explanation / Answer

1)enum cars { Audi,BMV,Chevy,Mercedes,Ford }

for (car c : car.values())  
System.out.println(c);

2)BitSet bits=new BitSet(5);

bits.set(1);

bits.set(3);

3) Vector v = new Vector();

v.add(new Integer(5));

v.add(new Double(1.6));

v.add(new Float(1.2));

for (int i=0;i<v,size();i++){

System.out.println(v.get(i));

}

4) Stack processes = new Stack();

processes.push("val1");

processes.push("val2");

processes.push("val3");

processes.push("val4");

processes.push("val5");

for(String s : processes)
{
System.out.println(s);
}  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote