Questions
Explain how the modular kernel design combines the benefits of both the layered and microkernel structures.

Explain how the modular kernel design combines the benefits of both the layered and microkernel structures.

In: Computer Science

make a python script that has the following typed: school = “cochise college” place = “online”...

make a python script that has the following typed:

school = “cochise college”

place = “online”

Then do the following with the given parameters.Set the script to have a function that takes two parameters, school and place, have your function return the first 5 characters of each parameter value, utilizing a slice. Change the script to have a function that takes two parameters, school and place, have your function return the first character of each parameter, utilizing an index value. Then, Modify the script to have a function that takes two parameters, school and place, have your function return the last character of the variable place for each parameter, utilizing an index value. Next, modify the script to have a function that takes two parameters, school and place, have your function return the variables school and place in title form. Lastly, modify the python script to have a function that takes two parameters, school and place, have your function check to verify that ‘cochise’ is in the school parameter and ‘online’ is in the place parameter. If it is have the function return, ‘Great you go to Cochise College Online!’, else have the function return, ‘You should check out Cochise College Online!’

In: Computer Science

The objective is to read the last five lines of a file (text file) in Perl....

The objective is to read the last five lines of a file (text file) in Perl. I wrote down what I have written so far in Perl but I get an error message saying, "Can't open sample.txt: No such file or directory." The sample.txt file is located in the same directory that I am executing the perl scripts on the command line.

sample.txt

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

My
name
is
Jennifer
and
I
like
to
eat
tacos
de
birria
.

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

#!/usr/bin/perl

$filename= 'sample.txt';

open my $fh, "+>", $file or die "Can't open $filename: $!\n";

print "$file[-5]\n";

print "$file[-4]\n";

print "$file[-3]\n";

print "$file[-2]\n";

print "$file[-1]\n";

In: Computer Science

I'm doing a practice test and I can't seem to find the answers anywhere for these...

I'm doing a practice test and I can't seem to find the answers anywhere for these specific questions. If someone could please help clarify so I can learn that would be helpful!

1. Identify the true statements. Select ALL that apply.


a. Setters and getters are not required for public instance variables.

b. A setter method is return-type void and takes a parameter of the same type as its field.

c. A getter method has the same return-type as the field it retrieves and takes no parameters.

d. Every private instance variable in a class definition must have a mutator method.

2.
private char gender;public class Person {

static int number;

//...

public static void main(String[] args) {

Person person;

   //...

}

public static void callPerson(int hours) {

double payRate = 24.99;

}

}

The code above compiles okay. Refer to it to complete this matching exercise.

_____

person

_____

hours

_____

number

_____

payRate

_____

gender

1.

local reference variable

2.

class variable

3.

instance variable

4.

parameter

5.

local primitive variable


3. Identify the true statements. Select ALL that apply.

a. Static methods are also class methods

b. Static methods of a class can be called without instantiating the class.

c. A static method cannot access the data members of its own class.

d. A non-static method can be called from a static method.

4. What does the public visibility modifier mean?

a. means accessible from any class in the same package.

b. means accessible to the current program.

c. means accessible to any method in the class.

d. means accessible from any other classes.

5.

3. public class Person {
4. private double salary;
5. public Person() {
6. salary = 1000.0;
7. }

What type of constructor is illustrated by lines 5 through 7?


6. Identify the true statements. Select ALL that apply.

a. Constants in a class should be declared as final static.

b. Static variables and static methods of a class can be accessed by an object of that class and by the class name.

c. Static variables have a default value of null.

d. Anonymous objects are possible in Java.


7. What Java keyword sometimes used in a class definition refers to the class itself?

In: Computer Science

This program does password verification. It gives the user three attempts to type in the correct...

This program does password verification. It gives the user three attempts to type in the correct password. Assume that the password is "COMSC110" (You can hard-code this). If the user types in the correct password, display a message saying "Login successful" and break out of the loop, otherwise display " Login Failed" and go to the next iteration. If the user enters three unsuccessful entries, then display a message saying " Too many attempts, Try again later", Use a while loop.

In: Computer Science

Write a program to simulate a calculator. Generate two random numbers (between 1-15) and an ask...

Write a program to simulate a calculator. Generate two random numbers (between 1-15) and an ask the user for an arithmetic operator. Using a switch statement, your program has to perform the arithmetic operation on those two operands depending on what operator the user entered. Ask the user if he/she wants to repeat the calculations and if the answer is yes or YES, keep repeating. If the answer is something else, then stop after the first calculation. c++

In: Computer Science

Write a program that prints the question “Do you wish to continue?” and reads the input....

Write a program that prints the question “Do you wish to continue?” and reads the input. If the user input is “Y”, “Yes”, “YES”, then print out “Continuing”. If the user input is “N” or “No”, “NO” then print out “Quit”. Otherwise, print “Bad Input”. Use logical operators. c++

In: Computer Science

Given the following relational schema, write queries in SQL to answer the English questions. There is...

Given the following relational schema, write queries in SQL to answer the English questions. There is a shipment database on the MySQL server. You can also use the DDL for MySQL. You must only submit the SQL for your answers but you can include the query output as well to help the TA with marking.

Customer(cid: integer, cname: string, address: string, city: string, state: string)
Product(pid: integer, pname: string, price: currency, inventory: integer)
Shipment(sid: integer, cid: integer, shipdate: Date/Time)
ShippedProduct(sid: integer, pid: integer, amount: integer)
  1. Return customer names and total sales of products shipped to each customer. Only show customers with total sales of over $200with the results ordered in descending order of total sales.

    Output:

    +-----------------+-------------+
    | cname           | total_sales |
    +-----------------+-------------+
    | Joe Smithsonian |     2427.80 |
    | Russell Johnson |     1057.68 |
    | Scott Charles   |      260.00 |
    +-----------------+-------------+

In: Computer Science

Given the following relational schema, write queries in SQL to answer the English questions. There is...

Given the following relational schema, write queries in SQL to answer the English questions. There is a shipment database on the MySQL server. You can also use the DDL for MySQL. You must only submit the SQL for your answers but you can include the query output as well to help the TA with marking.

Customer(cid: integer, cname: string, address: string, city: string, state: string)
Product(pid: integer, pname: string, price: currency, inventory: integer)
Shipment(sid: integer, cid: integer, shipdate: Date/Time)
ShippedProduct(sid: integer, pid: integer, amount: integer)
  1. Return the products (name) whose name contains 'Ch' with a price more than the average price.

    Output:

    +--------------+
    | pname        |
    +--------------+
    | Wooden Chair |
    +--------------+
    
  2. Return all customers and their states that share a state with another customer.

    Output: (Note: Order of rows does not matter.)

    +-----------------+-------+
    | cname           | state |
    +-----------------+-------+
    | Fred Smith      | IL    |
    | Joe Smithsonian | IA    |
    | Steve Stevenson | IL    |
    | Russell Johnson | CA    |
    | John Doe        | MI    |
    | Scott Charles   | CA    |
    | Shannon Rose    | MI    |
    | Beth Rosebud    | IA    |
    | Suzanne May     | IA    |
    +-----------------+-------+
    
  3. Return the shipment id and total value of the entire shipment (price*amount) ordered by the shipment values ascending.

    Output:

    +-----+----------------+
    | sid | Total_Shipment |
    +-----+----------------+
    |  12 |          45.49 |
    |   8 |          98.75 |
    |   7 |          98.97 |
    |  10 |         104.00 |
    |   4 |         164.95 |
    |   6 |         183.96 |
    |  11 |         260.00 |
    |   3 |         659.80 |
    |   5 |         676.00 |
    |   9 |        1664.00 |
    +-----+----------------+

In: Computer Science

In MATLAB: x = [1 3 4 6 7 10 11 15 16] y = [20...

In MATLAB:

x = [1 3 4 6 7 10 11 15 16]

y = [20 24 25 30 32 34 39 41 48]

This is an exercise in numerical differentiation.

Using the central difference method where possible, find dy/dx for the data set provided. Plot results.

In: Computer Science

so i want to read in a file. just to keep it simple, the text file...

so i want to read in a file. just to keep it simple, the text file has student name and the grade, separated by a space. let's say there are 192 student's name and I want to read them in and made them into a Student /object class, which has a constructor, student(string name, int grade). individually creating them seems pain in the ass. reading in should work for any number of names.

So how do I do this in c++?

In: Computer Science

Write program that prompts the user to enter a person's date of birth in numeric form...

Write program that prompts the user to enter a person's date of birth in numeric form such as 8-27-1980. The program then outputs the date of birth in the form: August 27, 1980. Your program must contain at least two exception classes: invalidDay and invalidMonth. If the user enters an invalid value for day, then the program should throw and catch an invalidDay object. Similar conventions for the invalid values of month and year. (Note that your program must handle a leap year.)


c++

In: Computer Science

a. Define the components of Case’s model (i.e., Storage Space, Operating Space) b. Describe how the...

a. Define the components of Case’s model (i.e., Storage Space, Operating Space)

b. Describe how the components of Case’s model change from early childhood (e.g., age 6 years) to late adolescence (e.g., age 18 years). You must provide written descriptions and you must describe how the components of Case’s model change over time.

In: Computer Science

Please fix these errors C++ In file included from main.cpp:14:0: Inventory.h:1:0: error: unterminated #ifndef #ifndef INVENTORY_H_...

Please fix these errors C++

In file included from main.cpp:14:0:
Inventory.h:1:0: error: unterminated #ifndef
 #ifndef INVENTORY_H_
 
main.cpp: In function ‘int main()’:
main.cpp:82:35: error: ‘adds’ was not declared in this scope
                    noun= adds(noun);
                                   ^
main.cpp:88:32: error: ‘display’ was not declared in this scope
                    display(noun);
                                ^
In file included from Inventory.cpp:4:0:
Inventory.h:1:0: error: unterminated #ifndef
 #ifndef INVENTORY_H_

----------------------------------------------------------------------------------

CODE: main.cpp

#include<iostream>
#include<string>
#include<vector>
#include "Inventory.h"

using namespace std;

int main()
{
Node * noun=NULL;
Node * verb=NULL;
int choice=0;
while(choice!=8)
{
cout<<"1. Push Noun\n";
cout<<"2. Pop Noun\n";
cout<<"3. Push Verb\n";
cout<<"4. Pop Verb\n";
cout<<"5. Concatenate\n";
cout<<"6. Add an s\n";
cout<<"7. Display Both Stacks\n";
cout<<"8. Exit\n";
cout<<"Enter your choice: ";
cin>>choice;
switch(choice)
{
case 1:
{
cout<<"Enter a noun: ";
string n;
cin>>n;
noun = push(noun,n);

  
}
break;
case 2:
{
cout<<"NOUN POPPED: ";
Node * t = pop(&noun);
if(t!=NULL)
cout<<t->data<<endl;
}
break;
case 3:
{
cout<<"Enter a verb: ";
string n;
cin>>n;
verb = push(verb,n);
  
}
break;
case 4:
{
cout<<"Verb POPPED: ";
Node * t = pop(&verb);
if(t!=NULL)
cout<<t->data<<endl;
}
break;
case 5: {
cout<<"Top two words on noun stack concatenated\n";
noun = concat(noun);
  
}
break;
case 6:
  
{
cout<<"Add s to the top word on noun stack\n";
noun = adds(noun);
}
break;
case 7:
{
cout<<"NOUN STACK\n";
display(noun);
cout<<"VERB STACK\n";
display(verb);
  
}
case 8:
{
}
break;
default: cout<<"Enter a valid choice\n";
  
}
}
return 0;
}

CODE: Inventory.cpp

#include<iostream>
#include<string>
#include<vector>
#include "Inventory.h"

using namespace std;

//display
void display(Node * head)
{
if(head==NULL)
{
  
return;
}
vector<string> stack;
Node * cur = head;
  
while(cur!=NULL)
{
stack.push_back(cur->data);
cur=cur->next;
}
for(int i = stack.size()-1;i>=0;--i)
{
cout<<stack.at(i)<<" ";
}
cout<<endl;
}

Node * adds(Node *head)
{
Node * top1 = pop(&head);
if(top1!=NULL)
{
//add s
string sol= top1->data + "s";
head=push(head,sol);
}
return head;
}

CODE: inventory.h

#ifndef INVENTORY_H_
#define INVENTORY_H_
#include<iostream>

using namespace std;

class Node
{
public:
string data;
Node * next;
Node()
{
data="";
next=NULL;
}
Node(string data)
{
data=data;
next=NULL;
}
};

Node * push(Node * head, string data)
{
if(head==NULL)
{
head=new Node();
head->data=data;
return head;
}
Node * cur = head;
while(cur->next!=NULL)
{
cur=cur->next;
}
Node * temp = new Node();
temp->data=data;
cur->next=temp;
return head;
}


Node * pop(Node ** h)
{
Node * head = *h;
if(head==NULL)
return NULL;
if(head->next==NULL)
{
  
Node * temp = head;
*h = NULL;
return temp;
}
Node * cur = head;
Node * prev = head;
  
while(cur->next!=NULL)
{
prev=cur;
cur=cur->next;
}
prev->next=NULL;

return cur;
}

Node * concat(Node * head)
{
Node * top1 = pop(&head);
Node * top2 = pop(&head);
  
if(top1!=NULL && top2!=NULL)
{
string solution = top1->data + top2->data;
head= push(head,solution);
  
}
return head;
}

In: Computer Science

In MATLAB: x = [1 3 4 6 7 10 11 15 16] y = [20...

In MATLAB:

x = [1 3 4 6 7 10 11 15 16] y = [20 24 25 30 32 34 39 41 48]

This is an exercise in numerical differentiation.

Using the central difference method where possible, find dy/dx for the data set provided. Plot results.

In: Computer Science