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
Shalnov [3]
2 years ago
12

You are developing a system to process lists of days of the week, represented as strings. Create a function is_weekend that cons

umes a list and returns whether the list has the string "Saturday" or the string "Sunday" in it. Call and print this function once with a list of days of the week.
Computers and Technology
1 answer:
Dafna11 [192]2 years ago
5 0

Answer:

   public static boolean is_weekend(List week){

       if(week.contains("Saturday")||week.contains("Sunday"))

       {

           System.out.println("List has a weekend");

           return true;

       }

       else{

           System.out.println("List has no weekend");

           return false;

       }

   }

Explanation:

  • Using java programming language
  • Import <em>java.util.ArrayList</em> and <em>import java.util.List;</em> so you can implement a java list
  • Create a list and add the days of the week
  • Create the required method using the contains() method to check for Sunday and Saturday and return true if the list contains them
  • See the complete program with a call to the method

<em>import java.util.ArrayList;</em>

<em>import java.util.List;</em>

<em>public class Car {</em>

<em>    public static void main(String[] args) {</em>

<em>        List<String> daysOfWeek = new ArrayList<>();</em>

<em>        daysOfWeek.add("Sunday");</em>

<em>        daysOfWeek.add("Moday");</em>

<em>        daysOfWeek.add("Tuesday");</em>

<em>        daysOfWeek.add("Wednesday");</em>

<em>        daysOfWeek.add("Thursday");</em>

<em>        daysOfWeek.add("Friday");</em>

<em>        daysOfWeek.add("Saturday");</em>

<em>        is_weekend(daysOfWeek);</em>

<em>    }</em>

<em>    public static boolean is_weekend(List week){</em>

<em>        if(week.contains("Saturday")||week.contains("Sunday"))</em>

<em>        {</em>

<em>            System.out.println("List has a weekend");</em>

<em>            return true;</em>

<em>        }</em>

<em>        else{</em>

<em>            System.out.println("List has no weekend");</em>

<em>            return false;</em>

<em>        }</em>

<em>    }</em>

}

You might be interested in
You wish to lift a 12,000 lb stone by a vertical
Shkiper50 [21]
Ndnsnskiaqosikejwnw sorry
3 0
3 years ago
Why crt and plasma are not used in laptop ?​
AlekseyPX

Answer:

Plasma monitors are power hungry devices 2 - 3 times more than a CRT monitor making this technology unfit for use in portable devices like laptop computers where batteries are used as the power source. Plasma monitors are extremely susceptible to screen burn.

Explanation: pls mark my answer as brainlist

6 0
2 years ago
What doyou mean by process model and project model?
vlabodo [156]

Answer:

A process model is a narrative of each type of process. These models consist of processes that are inherently similar and are categorized accordingly; a logical set of actions executed in a comprehensible framework.

A project model is concise and visual, it depicts how a project will be implemented. They are specifically tailored according to each project, describing each of its functional aspects. Decision gates and partitions are important aspects and need to be exemplified throughout the project.

4 0
2 years ago
Understanding photo album dialog box options
FrozenT [24]
Where are the options and the dialog
8 0
3 years ago
The number of colors available in a graphic is referred to as......what?
polet [3.4K]

<span>The number of colors available in a graphic is referred to as color depth. Color depth is also known as bit depth. It is the number of bits used to indicate the color of a single pixel, in a bitmapped image or video frame buffer or the number of bits used for each color component of single pixel.</span>

4 0
3 years ago
Other questions:
  • How Java provides protection through stack inspection approach ?
    7·1 answer
  • Utilities software and word processing software are both eamples of
    10·1 answer
  • PLEASE HELP
    12·2 answers
  • Search engines that search other search engines are called
    12·2 answers
  • A 10-foot ladder must make an angle of 30° with the ground if it is to reach a certain window. What angle must a 20-foot ladder
    9·2 answers
  • Celeste is writing a paper. However, two pages in, her computer shuts down unexpectedly. She never saved her paper, and all her
    12·2 answers
  • I will upvote....
    10·1 answer
  • Which of the following does not use a Graphic User Interface?
    14·1 answer
  • The merge sort algorithm____________.A. Can be used only on vectors of even length.B. Works by reducing vectors down to the base
    9·1 answer
  • What is the function for displaying differences between two or more scenarios side by side?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!