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
What are the two compatibility issues that may arise between computer systems while transferring presentations? different video
Mamont248 [21]

Different video files and operating system versions can cause compatibility issues to arise between computer systems.

Since, file formats and operating systems may not be compatible with each other. For example, earlier versions of Windows may not be able to play certain types of video files due to the codecs used to encode them.

<h3>Importance of compatibility between operating system computer systems</h3>

Compatibility between operating systems is important because it allows different computer systems to interact and share resources. This includes sharing of programs, files, and data.

Compatibility also allows users to access applications and services on different platforms. It also enables efficient use of hardware and software resources, as well as efficient use of resources in a network. Compatibility also ensures that computer systems can communicate with each other and can access the same resources. Without compatibility, it would be difficult for computer systems to interact with each other.

What are two compatibility issues that may arise between computer systems while transferring presentations? (Fill in the blank).

Different video files and _____ can cause compatibility issues to arise between computer systems.

Learn more about Compatibility between operating systems:

brainly.com/question/24760752

#SPJ4

4 0
1 year ago
Can someone please help me in answering this!?! <br> The language is C++
Llana [10]

Here is a somewhat cryptic solution that works:

#include <algorithm>

#include <cstdlib>

using namespace std;

void q(char c, int count)

{

for (int i = 0; i < count; i++) {

 putchar(c);

}

}

void p(int b1, int plusses)

{

q(' ', b1);

q('+', plusses);

}

int main()

{

for (int i = -3; i <= 3; i++)

{

 int pl = min(6, (3 - abs(i)) * 2 + 1);

 p(6-pl, pl);

 i == 0 ? p(0, 6) : p(6, 0);

 p(0, pl);

 putchar('\n');

}

getchar();

}


5 0
3 years ago
How does ur computer know that its cursor moved
Anton [14]
The sensor of a mouse connected to the computer or the touch pad being touched and swiped around on
8 0
3 years ago
Read 2 more answers
How many terabytes is a 128 gigabyte SD memory card
Maksim231197 [3]

Answer:

this would be .128 terabytes

Explanation:

This would be since for a whole terabyte you need 1000 gigabytes every 1000 gigabytes is a terabyte for example let’s say you have 5250 gigabytes you would have 5.250 terabytes that simple hope this helped!

4 0
2 years ago
Read 2 more answers
assume that youre creating a website for a school. you want to insert pictures of students and teachers. which tag will you use
sammy [17]

<u>Tag to insert pictures of students and teachers:</u>

While creating a website for a school, the developer would like to make it more attractive and appealing by adding hyperlinks, images, and videos.

In order to insert pictures of students and teachers, the developer will have to use the <img> tag. The <img> tag allows a user to an image to a webpage.

An example of inserting an image in a webpage is as follows:

<img src=""Annual.gif"" alt=""Annual Day"" height=""40"" width=""40"">

<img src=""Independence.gif"" alt=""Independence Day"" height=""40"" width=""40"">"

5 0
3 years ago
Read 2 more answers
Other questions:
  • Using the flowchart diagram, identifythe decision point of this solution?
    6·1 answer
  • According to the family life course development framework, the __________ stage of the family life cycle comes to an end with th
    7·1 answer
  • A(n) ____ is the computer counterpart to an ordinary paper file you might keep in a file cabinet or an accounting ledger.a. data
    6·1 answer
  • Select the correct answer.
    5·2 answers
  • Which objects appear on the slide after she clicks OK? Check all that apply.
    13·1 answer
  • Question 1(Multiple Choice Worth 5 points)
    9·1 answer
  • Module 1 and 2 Coding Guided Notes Fill in your answers to each response as you read through the lesson pages in the coding cour
    11·2 answers
  • Difference between electrical and electronic devices
    15·2 answers
  • Please please help I don’t understand
    6·1 answer
  • The Baltimore Sun reported on a study by Dr. Sara Harkness in which she compared the sleep patterns of 6-month-old infants in th
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!