Questions
import java.util.Scanner; public class MonthsOnAndAfter { // You will need to write a method that makes...

import java.util.Scanner;

public class MonthsOnAndAfter {
    // You will need to write a method that makes this
    // code compile and produce the correct output.
    // YOU MUST USE switch!
    // As a hint, you should not have to use the name of each
    // month more than once.
    // TODO - write your code below this comment.

    // DO NOT MODIFY main!
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter month (0-11): ");
        int month = input.nextInt();
        printMonthsOnAndAfter(month);
    }
}

In: Computer Science

Can you please solve these questions/ statements using python? I started with "importing" the file. I...

Can you please solve these questions/ statements using python? I started with "importing" the file. I only need question one to be answered not two-four. Can use whatever data frame of choice, I just need a sample code for each line. Thank you

#1. #Fit a linear regression model on data: USA_housing.csv to predict the Price of the house.
import pandas as pd

housing_df = pd.read_csv("USA_Housing.csv")

#Income: Avg. area income
#Age: Avg age of the houses
#Bedrooms: Avg No of bedrooms
#Rooms: Avg No of rooms
#Population: Population of the area
#Price: Average price in the area
#Address: THink of them as different ZIPcodes

#Also try to see if the model performance can be improved with feature selection.


#2. What is the difference between correlation and regression.

#3. Give three situations when there is correlation as well as causation

#4. Give three situations when there is correlation but no causation

In: Computer Science

Your lab instructor will guide you through the steps necessary to set up this project in...

Your lab instructor will guide you through the steps necessary to set up this project in Visual Studio. Video instructions for people using other programs can be found here: XCode, Code::Blocks and repl.it.

  • Using the lab samples as a starting point, write a program called lab4.cpp to input 10 float values from an input file input.txt.
    (Hint, you have to create the input.txt file yourself)
  • Output the sum and the average of the 10 float values to an output file output.txt.
  • Be sure to test to see if you opened the input and output files before you use them.
  • Compile and run this C++ program.
  • Run the program for your lab instructor and show the result in output.txt.

In: Computer Science

java programing Q: Given the following class: public class Student { private String firstName; private String...

java programing

Q: Given the following class:

public class Student {

private String firstName;

private String lastName;

private int age;

private University university;

public Student(String firstName, String lastName, int age, University university) {

this.firstName = fisrtName;

this.lastName = lastName;

this.age = age;

this.university = university;

}

public String getFirstName(){

return firstName;

}

public String getLastName(){

return lastName;

}

public int getAge(){

return age;

}

public University getUniversity(){

return university;

}

public String toString() {

return "\nFirst name:" + firstName + "\nLast name:" + lastName + " \nAge:"+ age + "\nUniversity" + university;

}

}

a- Create the University class (data type). The class must include name, state, and the country as member variables; it must also include methods for returning and storing the name, state, and country.

b- Create client code to test the classes.

In: Computer Science

Pattern matching using python3 re module Write a regular expression that will find out all the...

Pattern matching using python3 re module

Write a regular expression that will find out all the words that ends with 4 consecutive vowels at the end.

Example: import re

f=open("/usr/share/dict/american-english",'r')

pattern='a[a-z]*d$'

words=f.readlines()

matchlist=[word for word in words if re.match(pattern,word)]

===============================

Generate random string follow a specific pattern

You will take a username and ask user for the password. User has to enter a strong password in order to create his or her account. The criteria for strong password is, a) Starts with a letter a to z or A to Z b) Cannot end with a digit c) Total character should be 10 d) The character can be letter a to z or A to Z or digit 0 to 9 or _

You will show a message that account is successfully created if user enters a strong password. If a user does not enter a strong password, you will reject the user entered password and generate a strong password as follows: a) Starts with the first character of the user’s user name b) Ends with the last character of the user’s user name c) Total character should be 10 d) The character can be letter a to z or A to Z or digit 0 to 9 or _

Sample output: Account is successfully created

Another sample output: Week Password

Generating a Strong Password

The auto generated password: j57m9XoUGa

In: Computer Science

How many times will the following crontab entry execute during January 2018? 0 0 * 1...

  1. How many times will the following crontab entry execute during January 2018?
    0  0  *  1  1  rm -r /root/backup/*
  2. How many times will the following crontab entry execute during January 2018?
    0  0  *  1  6  rm -r /root/backup/*
  3. List all of the dates the following crontab entry will execute during 2018 (this answer is a little tricky).
    0  0  1/10  *  7  rm -r /root/backup/*

In: Computer Science

Please use PYTHON on colab notebook Here's the list: [[‘Five Guys’,1,3],[‘Burger King’,5,7],['Nack Stick’,4,4][‘Pizza Hut’,7,2],[‘Taco Time’,1,8],[‘McDonalds’,5,7],['Taco Bell’,4,3]]...

Please use PYTHON on colab notebook

Here's the list:

[[‘Five Guys’,1,3],[‘Burger King’,5,7],['Nack Stick’,4,4][‘Pizza Hut’,7,2],[‘Taco Time’,1,8],[‘McDonalds’,5,7],['Taco Bell’,4,3]]

The task is to write a loop that uses the function function2(a,b) (I have it down below)to create a dictionary called bus_dic which has all the business names above as keys and has it followed by the flying distance.f

For example,

when you type in bus_dist["Five Guys"] you should get 3.16227766

If you need anything else, please leave a message. Thank you!

The functio2

def function2(a,b):
   c = a*a + b*b
   d = c ** 0.5
   return d

In: Computer Science

Hosts A and B are communicating over a TCP connection and Host B has already received...

Hosts A and B are communicating over a TCP
connection and Host B has already received from A all bytes up through byte 126.

Suppose Host A then sends two segments to Host B back-to-back (See the figure below). The first and second segments contain 80 and 40 bytes of data respectively. In the first segment, the sequence number is 127, the source port number is 302, and the destination port number is 80. Host B sends an acknowledgment whenever it receives a segment from Host A.

1) In the second segment from Host A to B, the sequence number is                            [ Select ]                       ["208", "207", "80", "206"]         , the source port number is                            [ Select ]                       ["302", "80"]         and the destination port number is                            [ Select ]                       ["", "80", "302"]         .

2) If the first segment arrives before the second, in the acknowledgment of the first arriving segment, the acknowledgment number is                            [ Select ]                       ["80", "207", "127", "302"]         , the source port number is                            [ Select ]                       ["80", "302"]         and the destination port number is                            [ Select ]                       ["80", "302"]         .

In: Computer Science

The school bookstore wants you to write a Python script to calculate the point of sale...

The school bookstore wants you to write a Python script to calculate the point of sale (total cost) of their new 25$ gift cards. They are also running a special, if a customer buys a gift card they can buy all books for 5$ dollars each. The gift card cost is $25.00 plus $5.00 per book. In addition, there is a sales tax which should be applied to the subtotal and it is 8% (multiply the subtotal by 0.08.) Requirements: Write a Python script (with meaningful comments) that has a main() function. Have that main() function call another function to display a welcome to the customer. In the main() function, ask the user how many gift cards they would like and how many books they have picked out. Function requirements are as follows: You must write a function to calculate the cost for the gift card(s), a function to calculate the cost of the books, and a function that takes the subtotal applies the 8% (multiply by 0.08) sales tax then returns the total to main(). Display the subtotal in main(). Round all dollar amounts to 2 decimal places (note: python will truncate unnecessary 0s without formatting so do not worry if output only has the tenths place). Only function definitions and the call to main() can be at 1st level indentation. For a challenge, see if you can make your main function contain less lines that the other functions.

Examples:

Welcome to the bookstore!

Gift cards are $25.00 each

Each book costs $5.

How many gift cards do you want? 1

How many books do you have? 2

Your subtotal is $35

Your total is $37.8

and

Welcome to the bookstore!

Gift cards are $25.00 each

Each book costs $5.

How many gift cards do you want? 2

How many books do you have? 4

Your subtotal is $70

Your total is $75.6

In: Computer Science

fp=open("us-counties.2.txt","r") #open file for reading fout=open('Linsey.Prichard.County.Seats.Manipulated.txt','w') #file for writting states=[i.strip() for i in fp.readlines()] #read the...

fp=open("us-counties.2.txt","r") #open file for reading
fout=open('Linsey.Prichard.County.Seats.Manipulated.txt','w') #file for writting
states=[i.strip() for i in fp.readlines()] #read the lines
try:
#aplit values and write into file
a,b=state.split(',')
print(a,b)
#write into file
fout.write(a+":"+b+"\n")\
except Exception#if we dont have two names (For a line like KENTUCKY or OHIO, It continues)
Pass

evaluate Data. Manipulation.py]
Traceback (most recent call last):
File "C:/Users/Prichard/Data. Manipulation.py", line 10, in <module>
except Exception#if we dont have two names (For a line like KENTUCKY or OHIO, It continues)
Syntax Error: invalid syntax: <string>, line 10, pos 9

Can someone tell me why I am getting this error?

In: Computer Science

Anomaly Dection For avoiding false discoveries, data mining introduces many statistical testing methods to define reliable...

Anomaly Dection

For avoiding false discoveries, data mining introduces many statistical testing methods to define reliable data mining results. Select at least two statistical methods and discuss how they find unreliable patterns and relationship in the data mining results. Also, you have to mention how these methods can be applied to typical data mining tasks to help ensure that the resulting models and patterns are valid

Need 300 words with no plagrism

In: Computer Science

Recall that the Cell Phones & Stuff server will provide many services and roles. These services...

Recall that the Cell Phones & Stuff server will provide many services and roles. These services include Active Directory, DNS, DHCP, FTP, print services, and email. You have decided to use virtualization in your implementation. How will you implement the services within the virtual realm? Please address the following questions and be sure to provide justifications for your decisions:

How do you plan to create, configure, and manage virtual machines (VMs) for the company?

What services will those VMs offer?

How many virtualized servers will you create? Why?

In: Computer Science

1) How is neuroscience and technology interrelated? 2) In what sense does brain and machine comparable?...

1) How is neuroscience and technology interrelated?

2) In what sense does brain and machine comparable?

3) To what extent does AI affects lives of human? Cite examples

In: Computer Science

Write a class called Animal that contains a static variable called count to keep track of...

Write a class called Animal that contains a static variable called count to keep track of the number of animals created. Your class needs a getter and setter to manage this resource. Create another variable called myCount that is assigned to each animal for each animal to keep track of its own given number. Write a getter and setter to manage the static variable count so that it can be accessed as a class resource

In: Computer Science

Build a Date class and a main function to test it Specifications Below is the interface...

Build a Date class and a main function to test it

Specifications
Below is the interface for the Date class: it is our "contract" with you: you have to implement everything it describes, and show us that it works with a test harness that puts it through its paces. The comments in the interface below should be sufficient for you to understand the project (use these comments in your Date declaration), without the need of any further documentation.

class Date
{
 private:
   unsigned day;
   unsigned month;
   string monthName;
   unsigned year;

 public:
   // creates the date January 1st, 2000.
   Date();


   /* parameterized constructor: month number, day, year 
       - e.g. (3, 1, 2010) will construct the date March 1st, 2010

       If any of the arguments are invalid (e.g. 15 for month or 32 for day)
       then the constructor will construct instead a valid Date as close
       as possible to the arguments provided - e.g. in above example,
       Date(15, 32, 2010), the Date would be corrected to Dec 31st, 2010.
       In case of such invalid input, the constructor will issue a console error message: 

       Invalid date values: Date corrected to 12/31/2010.
       (with a newline at the end).
   */
   Date(unsigned m, unsigned d, unsigned y);


   /* parameterized constructor: month name, day, year
 ­      - e.g. (December, 15, 2012) will construct the date December 15th, 2012

       If the constructor is unable to recognize the string argument as a valid month name,
       then it will issue a console error message: 

       Invalid month name: the Date was set to 1/1/2000.
       (with a newline at the end).

       If the day argument is invalid for the given month (but the month name was valid),
       then the constructor will handle this error in the same manner as the other
       parameterized constructor. 

       This constructor will recognize both "december" and "December"
       as month name.
   */
   Date(const string &mn, unsigned d, unsigned y);


   /* Outputs to the console (cout) a Date exactly in the format "3/1/2012". 
      Does not output a newline at the end.
   */
   void printNumeric() const;


   /* Outputs to the console (cout) a Date exactly in the format "March 1, 2012".
      The first letter of the month name is upper case, and the month name is
      printed in full - January, not Jan, jan, or january. 
      Does not output a newline at the end.
   */
   void printAlpha() const;

 private:

   /* Returns true if the year passed in is a leap year, otherwise returns false.
   */
   bool isLeap(unsigned y) const;


   /* Returns number of days allowed in a given month
      -  e.g. daysPerMonth(9, 2000) returns 30.
      Calculates February's days for leap and non-­leap years,
      thus, the reason year is also a parameter.
   */
   unsigned daysPerMonth(unsigned m, unsigned y) const;

   /* Returns the name of a given month
      - e.g. name(12) returns the string "December"
   */
   string name(unsigned m) const;

   /* Returns the number of a given named month
      - e.g. number("March") returns 3
   */
   unsigned number(const string &mn) const;
};

Private Member Functions

The functions declared private above, isLeap, daysPerMonth, name, number, are helper functions - member functions that will never be needed by a user of the class, and so do not belong to the public interface (which is why they are "private"). They are, however, needed by the interface functions (public member functions), which use them to test the validity of arguments and construct valid dates. For example, the constructor that passes in the month as a string will call the number function to assign a value to the unsigned member variable month.

isLeap: The rule for whether a year is a leap year is:

(year % 4 == 0) implies leap year

except (year % 100 == 0) implies NOT leap year

except (year % 400 == 0) implies leap year

So, for instance, year 2000 is a leap year, but 1900 is NOT a leap year. Years 2004, 2008, 2012, 2016, etc. are all leap years. Years 2005, 2006, 2007, 2009, 2010, etc. are NOT leap years.

Output Specifications

Read the specifications for the print function carefully. The only cout statements within your Date member functions should be:

1. the "Invalid Date" warnings in the constructors

2. in your two print functions

Required main function to be used:

Date getDate();

int main() {

   Date testDate;
   testDate = getDate();
   cout << endl;
   cout << "Numeric: ";
   testDate.printNumeric();
   cout << endl;
   cout << "Alpha:   ";
   testDate.printAlpha();
   cout << endl;

   return 0;
}

Date getDate() {
   int choice;
   unsigned monthNumber, day, year;
   string monthName;

   cout << "Which Date constructor? (Enter 1, 2, or 3)" << endl
      << "1 - Month Number" << endl
      << "2 - Month Name" << endl
      << "3 - default" << endl;
   cin >> choice;
   cout << endl;

   if (choice == 1) {
      cout << "month number? ";
      cin >> monthNumber;
      cout << endl;
      cout << "day? ";
      cin >> day;
      cout << endl;
      cout << "year? ";
      cin >> year;
      cout << endl;
      return Date(monthNumber, day, year);
   } else if (choice == 2) {
      cout << "month name? ";
      cin >> monthName;
      cout << endl;
      cout << "day? ";
      cin >> day;
      cout << endl;
      cout << "year? ";
      cin >> year;
      cout << endl;
      return Date(monthName, day, year);
   } else {
      return Date();
   }
}

In: Computer Science