Questions
Match each function type correctly. Question 1 options: In this parameter type, the memory location of...

Match each function type correctly.

Question 1 options:

In this parameter type, the memory location of the variables from the invoking function are passed to the called function.

In this parameter type, a copy of the variables from the invoking function are passed to the called function.

1.

Pass By Value

2.

Pass By Reference

In: Computer Science

C++ UNIX car.txt 0001|Mercury|LeSabre|2005|Brown|11000|2019-09-01 0002|Chevrolet|Aveo|2013|Blue|12000|2019-09-02 0003|Datsun|240Z|1979|Orange|13000|2019-09-03 0004|Ford|Galaxie|1964|Black|14000|2019-09-04 0005|Porsche|Boxster|2014|Green|15000|2019-09-0 #i

C++ UNIX

car.txt

0001|Mercury|LeSabre|2005|Brown|11000|2019-09-01
0002|Chevrolet|Aveo|2013|Blue|12000|2019-09-02
0003|Datsun|240Z|1979|Orange|13000|2019-09-03
0004|Ford|Galaxie|1964|Black|14000|2019-09-04
0005|Porsche|Boxster|2014|Green|15000|2019-09-0

#include <fstream>
#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main()
{
  
   const int RECORDS = 42;
   ifstream reader("car.txt");
   if(!reader) {
       cout << "Error: cannot open input file" << endl;
       return -1;
   }
   string item[RECORDS];
   int i = 0;
   while(!reader.eof()) {
       if((i+1) % 7 == 0)
           getline(reader,item[i++],'\n');
       else
           getline(reader,item[i++],'|');
   }
   i = 0;
   while(i < RECORDS) {
       cout << "(1) carID= " << item[i++] << endl;
       cout << "(2) carManufacturer= " << item[i++] << endl;
       cout << "(3) carModel= " << item[i++] << endl;
       cout << "(4) carYear= " << item[i++] << endl << endl;
       cout << "(5) carColor= " << item[i++] << endl << endl;
       cout << "(6) carPrice= " << item[i++] << endl << endl;
       cout << "(7) carInventoryDate= " << item[i++] << endl << endl;   
   }
   reader.close();
   return 0;
}

this is my code to read that text file.

and output should be

(1) carID=0001
(2) carManufacturer=Mercury
(3) carModel=LeSabre
(4) carYear=2005
(5) carColor=Brown
(6) carPrice=11000
(7) carInventoryDate=2019-09-01

and so on.

but my output is

(1) carID= 0001
(2) carManufacturer= Mercury
(3) carModel= LeSabre
(4) carYear= 2005

(5) carColor= Brown

(6) carPrice= 11000

(7) carInventoryDate= 2019-09-01

like this. I don't know why there is space between 4, 5, 6, 7

please help me to fix

Thank you

In: Computer Science

make a 4x4 tic tac toe in javascript (X is the user) (O is the computer)

make a 4x4 tic tac toe in javascript (X is the user) (O is the computer)

In: Computer Science

Programming in R test1 [1] 62.21030 57.60602 86.21137 84.73354 83.74019 69.68914 84.57337 68.31329 74.84393 77.75101 69.23417...

Programming in R

test1

[1] 62.21030 57.60602 86.21137 84.73354 83.74019 69.68914 84.57337 68.31329 74.84393 77.75101 69.23417 66.95640
[13] 68.56414 71.97554 63.92802 74.36488 72.45757 72.37171 72.23253 86.86378 91.33591 60.92220 94.63742 78.92828
[25] 85.36320 65.42284 77.67914 74.72229 66.06849 66.18031

test2

[1] 70.92537 61.84501 79.35110 66.56921 85.24835 71.78693 77.12057 82.20876 71.54209 66.11271 62.46592 79.36359
[13] 73.91162 77.18452 71.46808 72.78128 82.57056 78.34531 59.93903 64.00577 72.96255 75.81221 69.76166 68.04771
[25] 64.12077 84.65762 64.87694 80.51515 78.21864 79.27847

The two vectors above (test1 and test2) represent exam scores from two different classes of size 30 (taught by two different teachers). If one class is scoring significantly higher than the other, it could be interpreted that one teacher is more effective than the other.

a. Find the mean test score for each class. Which class did better, based on means? Would you say they did significantly better?

b. Create comparative (side-by-side) boxplots in R for the two classes. Based on these, do you believe one teacher is more effective than the other? Significantly more effective?

c. Create comparative density plots for the two small classes on the same set of axes (you can use par(new=TRUE)) and make sure xlim and ylim are the same). Based on these, do you believe one teacher is more effective than the other? Significantly more effective?

d. Perform a two-sample t-test (one-tailed) to see if there is a difference in the population means for the two classes. Based on these, do you believe one teacher is more effective than the other? Significantly more effective? Significant in what sense?

In: Computer Science

What are the differences between capabilities and ACLs?

  • What are the differences between capabilities and ACLs?

In: Computer Science

Do you think that UML can move into the next decade and still be relevant? If...

Do you think that UML can move into the next decade and still be relevant? If we think about the type of work being done and our increased dependence upon mobile apps and AI, can we count on UML?

In: Computer Science

Why is virtualization so important for managing servers in “the cloud”?

  • Why is virtualization so important for managing servers in “the cloud”?

In: Computer Science

An employment agency needs to convert its basic one-table management system into a modern information management...

An employment agency needs to convert its basic one-table management system into a modern information management system/database that can hold its improving business. You are hired to create this IMS and the first step you are carrying out is normalization. The table that the agency originally uses is the following:

APPLICATION(ApplicantName, AppicantPhone1, ApplicantPhone2, ApplicantAddress, ApplicantFieldOfInterest, ApplicanHighestLevelOfEducation, EmployerBusinessName, EmployerAddress, EmployerPhoneNumber, EmployerCity, EmployerEmail, JobPostingID, JobPostingTitle, JobYearlySalary, InterviewId, InterviewDate, NamesOfInterviewers, OfferDetailsIfApplicable)

Rules:

- Applicants can be identified by their phone number(s)

- No two employers can have the same name

- Employers can post more than 1 posting

- Applicant can apply for more than one posting

You are required to put the previous table in 4NF (step-by-step: 1NF, 2NF, 3NF and 4NF).

In: Computer Science

What are the disadvantages of contiguous files, indexed files, and multi-level indexed files? What general approach...

  • What are the disadvantages of contiguous files, indexed files, and multi-level indexed files?
  • What general approach improves performance of multi-level indexed files?

In: Computer Science

Why are device drivers the most failure-prone part of operating systems? How does the OS designs...

  • Why are device drivers the most failure-prone part of operating systems?
  • How does the OS designs we discussed earlier in the semester, e.g., exokernels, microkernels, etc., address the problem with device drivers?

In: Computer Science

ALL IN PYTHON PLEASE Problem 1: Accept one integer from the user and store that information...

ALL IN PYTHON PLEASE

Problem 1: Accept one integer from the user and store that information in a variable called endNo. Use an IF structure to check that endNois a positive number. If endNo is negative, print an error message and stop. If it is positive, use a loop (for or while) to generate odd numbers from 1 to endNo. Calculate the sum of these numbers using an accumulator.

Rubric:

Data input and data type conversions: 2.5 pts
Use of IF structure to verify that endNo is positive: 2.5 pts
Use of loop to generate numbers from a (inclusive) to b (not inclusive): 5 pts
Use of an accumulator (note: print the cumulative sum only once): 5 pts

Problem 2:

Modify problem 1 and allow the user to specify the (a) starting value for the loop, (b) stopping value for the loop, and (c) the step function. Please note that the stopping value must be included in the calculation of your running total. Example of the desired solution:

Enter starting value: 5

Enter stopping value: 15

Enter step value: 5

30


In the above example, the result (30) is the sum of 5 + 10 + 15. Note that both the starting value and ending value are included in the running total. The step value determines the series.

Rubric:

Modification of the loop function: 5 pts

Problem 3:

Define a VALUE-RETURNING function that accepts one parameter - an integer number. The function, which must be a value-returning function, returns 1 if the number is even or 0 if the number is odd. In the “main” function (i.e. def main()), capture the return value and print an appropriate message on screen (i.e. number is even or odd).

Rubric:

Correctly defined a value-returning function: 5 pts

Correctly capture and use return value from a value-returning function: 5 pts

Sample Output:

Enter n: 4
Even

Problem 4

Write a program to compute the area of a circle some 'n' times. You must accept n and r from the user. Area is calculated using (22/7.0)*r*r - where r is the radius. Implement using value-returning functions. Hint: create a function to calculate area taking r as a parameter. In the main() function, ask for n and create a loop where you input r and invoke the area function n times.

Rubric:

Correct use of a loop to perform n calculations for the user: 5 pts
Correct use of value-returning functions inside a loop structure: 10 pts

Sample Output:

Enter n: 3

Enter r: 34

Area is: 3633.14285714

Enter r: 23

Area is: 1662.57142857

Enter r: 43

Area is: 5811.1428571

In: Computer Science

This the question about the java and please show the detail comment and code of each...

This the question about the java and please show the detail comment and code of each class.Thank you.

And the "+" means "public" the "-" means "private" and testBankAccount(): void testMobilePhone(): void testChocolate(): void all are static

Create four classes with the following UML diagrams:
+-----------------------------+
| BankAccount |
+-----------------------------+
| - money: int |
+-----------------------------+
| + BankAccount(int money) |
| + getMoney(): int |
| + setMoney(int money): void |
| + testBankAccount(): void |
+-----------------------------+
+------------------------------------------------+
| MobilePhone |
+------------------------------------------------+
| - number: int |
| - account: BankAccount |
+------------------------------------------------+
| + MobilePhone(int number, BankAccount account) |
| + getNumber(): int |
| + payMoney(int amount): boolean |
| + testMobilePhone(): void |
+------------------------------------------------+
A mobile phone has a phone number and is connected to a bank account. The owner of the mobile phone can use the mobile phone to pay money: if amount is not negative and if the bank account connected to the mobile phone has enough money in it then the money in the bank account is decreased by amount and the payMoney method must return true, otherwise nothing changes for the bank account and the method must return false.
+-----------------------------+
| Chocolate |
+-----------------------------+
| - weight: double |
+-----------------------------+
| + Chocolate(double weight) |
| + getWeight(): double |
| + buy(int money): void |
| + eat(double amount): void |
| + testChocolate(): void |
+-----------------------------+
If the constructor of the Chocolate class is given a negative weight as argument then the weight must be changed to 0.0 Kg.
When buying chocolate, the weight of chocolate increases, with the price of chocolate being RMB 100 per 1.5 Kg. It is not possible to buy a negative amount of chocolate, so in that case the buy method must print a message "Cannot buy negative amount of chocolate" and nothing else happens.
It is not possible to eat more chocolate than there is chocolate, so in that case the eat method must print a message "Cannot eat nonexistent chocolate, only XXX Kg available" (where XXX is replaced with the current weight of chocolate) and nothing else happens.
+-----------------------------------+
| Student |
+-----------------------------------+
| - name: String |
| - phone: MobilePhone |
| - chocolate: Chocolate |
+-----------------------------------+
| + Student(String name, int money) |
| + getName(): String |
| + getChocolateWeight(): double |
| + hungry(int money): void |
| + testStudent(): void |
+-----------------------------------+
When a student is created, the student has 0.0 Kg of chocolate and a mobile phone which is connected to a bank account with money in it. Use your student ID number as the phone number for the mobile phone.
When the student is hungry, the student first tries to use the mobile phone to pay the money amount. If the payment is successful then the student buys the chocolate corresponding to the same money amount of the payment and then the student eats half of the weight of chocolate that has just been bought (not half of the total weight of chocolate). If the payment is not successful then the hungry method must print a message "Student is still hungry!" and nothing else happens.
Each class has a static test method that contains tests for all the constructors and all the methods of the class. For each class, test the simple methods first and the more complicated methods next. For each constructor and each method, make sure that you test every possible case.
Add to your software a Start class with a main method that calls the test method of each of the four classes, to test everything in your software.

In: Computer Science

The program should be written in C++ with comments Write a program that takes graduation rates...

The program should be written in C++ with comments

Write a program that takes graduation rates (per 1000 of the population) for North, South, East, West and Central United States. Input the number from each of the regions in a function returning an int with the graduation rate to the main program. Also figure out which region has the highest graduation rate in another function and display the result from inside that particular function.

So your function prototypes should be something like:
int gradrate( );
void highestgrad(double n, double south, double east, double west, double central);

So you are using gradrate to read in the value of 0 to 1000 to give it to the north, south, east, west or central variables like: north = gradrate() / 1000.0;

In: Computer Science

Do you think there will ever be a need for yet another level of nested virtualization?...

  • Do you think there will ever be a need for yet another level of nested virtualization?
  • What would be some use cases for nested virtualization?

In: Computer Science

To the Dragon Curve, use the 90 degree turns and then the L-System rules: ------------------------------------------------------- FX...

To the Dragon Curve, use the 90 degree turns and then the L-System rules:
-------------------------------------------------------
FX
X -> X+YF+
Y -> -FX-Y
------------------------------------------------------
the rules code have
to be in the go in the applyRules function so complete!!!

Here the starter code
import turtle

def createLSystem(numIters, axiom):
startString = axiom
endString = ""
for i in range(numIters):
endString = processString(startString)
startString = endString

return endString

def processString(oldStr):
newstr = ""
for ch in oldStr:
newstr = newstr + applyRules(ch)

return newstr

def applyRules(ch):
newstr = ""
  
#Your code here

return newstr

def drawLsystem(aTurtle, instructions, angle, distance):
for cmd in instructions:
if cmd == 'F':
aTurtle.forward(distance)
elif cmd == 'B':
aTurtle.backward(distance)
elif cmd == '+':
aTurtle.right(angle)
elif cmd == '-':
aTurtle.left(angle)

def main():
inst = createLSystem(10, "FX") # create the string
print(inst)
t = turtle.Turtle() # create the turtle
wn = turtle.Screen()

t.up()
t.back(200)
t.down()
t.speed(100)
drawLsystem(t, inst, 90, 5) # draw the picture
# angle 90, segment length 5
wn.exitonclick()

main()

In: Computer Science