Need Help Filling in Areas: /** Based on a Big Java problem You have to write a static method that removes every other element from a linked list.
Expected output: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]
[Monday, Wednesday, Friday]
[Wednesday]
[] */ public class DownSizeTester
{
public static void main(String[] args)
{
LinkedList list = new LinkedList() ;
list.add("Sunday") ;
list.add("Monday") ;
list.add("Tuesday") ;
list.add("Wednesday") ;
list.add("Thursday") ;
list.add("Friday") ;
list.add("Saturday") ;
System.out.println(list) ;
downsize(list) ;
System.out.println(list) ;
downsize(list) ;
System.out.println(list) ;
downsize(list) ;
System.out.println(list) ;
}
/** Removes the first, third, fifth, ... elements from a list. @param list a linked list of String elements */
public static void downsize(LinkedList list) {
//-----------Start below here. To do: approximate lines of code = 6 // 1-6. Remove the first, third, fifth, ... elements from list //-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions. } }
PLEASE GIVE IT A THUMBS UP



import java.util.LinkedList;
import java.util.Vector;
import java.lang.*;
class DownSizeTester
{
public static void main(String[] args)
{
LinkedList list = new LinkedList();
list.add("Sunday");
list.add("Monday");
list.add("Tuesday");
list.add("Wednesday");
list.add("Thursday");
list.add("Friday");
list.add("Saturday");
System.out.println(list);
downsize(list);
System.out.println(list);
downsize(list);
System.out.println(list);
downsize(list);
System.out.println(list);
}
/** Removes the first, third, fifth, ... elements from a list. @param list a linked list of String elements */
public static void downsize(LinkedList list) {
//-----------Start below here. To do: approximate lines of code =
6
// 1-6. Remove
the first, third, fifth, ... elements from list
//-----------------End here. Please do not remove this comment.
Reminder: no changes outside the todo regions.
Vector v = new
Vector();
for(int
i=0;i<list.size();i++){
if(i%2==0)
v.add(i);
}
for(int
i=0;i<v.size();i++)
list.remove(i);
}
}
Need Help Filling in Areas: /** Based on a Big Java problem You have to write...
need help with java questions
The following snippet of code would produce what outcome? public static void main(String 2 [] args) { int day = 5; switch (day) { case 1: System.out.println("Monday "); case 2: System.out.println("Tuesday "); case 3: System.out.println("Wednesday "); case 4: System.out.println("Thursday "); case 5: System.out.println("Friday "); case 6: System.out.println("Saturday "); case 7: System.out.println("Sunday "); break; default: System.out.println("Invalid Day "); } } Invalid Day Friday Saturday Sunday Invalid Day Friday Friday Saturday Sunday What will be the output...
[Java] Please test your code in the link I provide
before you post your answer.
The output should be looked like exact same as the
tester.
http://www.codecheck.it/files/17033122188mcxvjz8n8qbk0k9fyfrd3w95
Use the following file:
LinkedListUtilTester.java
import java.util.LinkedList;
public class LinkedListUtilTester
{
public static void main(String[] args)
{
LinkedList<String> list = new LinkedList<>();
list.add("1");
list.add("2");
list.add("3");
list.add("4");
list.add("5");
list.add("6");
list.add("7");
list.add("8");
list.add("9");
list.add("10");
list.add("11");
list.add("12");
list.add("13");
list.add("14");
list.add("15");
LinkedListUtil.shrink(list, 3);
System.out.println(list);
System.out.println("Expected: [1, 2, 4, 5, 7, 8, 10, 11, 13, 14]");
System.out.println(LinkedListUtil.reverse(list));
System.out.println("Expected:...
Please Refactor this Assignment by using Arraylist instead of Array. import java.util.Scanner; public class DaysOfWeeks { public static void main(String[] args) { String DAY_OF_WEEKS[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}; char ch; int n; Scanner scanner = new Scanner(System.in); do { System.out.print("Enter the day of the Week: "); n = scanner.nextInt() - 1; if (n >= 0 && n <= 6) System.out.println("The day of the week is " + DAY_OF_WEEKS[n] + "."); else System.out.println("Invalid Entry"); System.out.print("Try again (Y/N): "); ch = scanner.next().charAt(0); }while(ch=='Y'); }...
NO ONE HAS PROVIDED THE CORRECT CODE TO PROVIDE THE GIVEN OUTPUT. PLEASE PROVIDE CODE THAT WOULD CAUSE THE HW1.java TO PRINT THE RIGHT DATA.!!! The LinkedList class implements both the List interface and the Stack interface, but several methods (listed below) are missing bodies. Write the code so it works correctly. You should submit one file, LinkedList.java. Do not change the interfaces. Do not change the public method headers. Do not rename the LinkedList class. None of your methods...
Write a C++ Program. You have a following class as a header file (dayType.h) and main(). #ifndef H_dayType #define H_dayType #include <string> using namespace std; class dayType { public: static string weekDays[7]; void print() const; string nextDay() const; string prevDay() const; void addDay(int nDays); void setDay(string d); string getDay() const; dayType(); dayType(string d); private: string weekDay; }; #endif /* // Name: Your Name // ID: Your ID */ #include <iostream>...
THIS CODE SHOULD BE MODIFIED TO READ SuperMarket.dat instead of Inputting and Outputting. SuperMarket.dat Monday 4 Monday 6 Monday 2 Tuesday 3 Tuesday 2 Wednesday 3 Wednesday 5 Wednesday 7 Thursday 5 Friday 4 Friday 3 Friday 4 Saturday 8 Saturday 8 Saturday 8 Sunday 0 QUESTION: Write the control break code, including the code for the dayChange() method, in the main() method. // SuperMarket.java - This program creates a report that lists weekly hours worked // by employees of...
Using the function you wrote in part 3a (refer to the bottom), write another function that, given the number of days in the month, and the day that the month starts on, the number of days that Inky Blinky Pinky and Clyde will get to play pinball in that month. The function provided will increment the day of the week to the next correct day. Function written in 3a): def pinball(dayOfWeek, dayOfMonth) : if dayOfMonth % 4 ==0: return "Pinky"...
Activity 2. Complete the code inside the Java file below, ListUtil.java, such that this class supplies a utility method to reverse the entries in a linked list. Then, test your code using the tester class, Reverse Tester.java, given below. ListUtil.java import java.util.LinkedList; /** This class supplies a utility method to reverse the entries in a linked list. */ public class ListUtil { /** Reverses the elements in a linked list @param strings the linked list to reverse public static void...
I need to write a program in java using two array lists. I need to program to prompt the user to enter a day of the week and return an output of a predetermined temperature for the day they selected. I also need the program the output the average of daily temperatures across the week if the user inputs "week". So basically if i set the temperatures to something arbitrary i.e.: Monday = 50 Tuesday = 55 Wednesday = 52...