Questions
For the following C++ code, identify the 10 errors and rewrite the code using the space...

For the following C++ code, identify the 10 errors and rewrite the code using the space provided below. Do not write a new program just add, remove or change the characters/words that make the code incorrect. #include "iostream> using namespace std: class Line { public: Line( double L ) [ setLength(L); } void setLength( double L ) { length = L } double getLength( void ) { return length; } private= double length; }; int main() { double len; cout >> "How long is this line? " cin >> len; Line = line(len); Line *LPtr = line; cout << "Length of line : " << LPtr.getLength() << endl; }

In: Computer Science

Using Python: Write a program that takes a user-inputted integer and prints out the value of...

Using Python:

Write a program that takes a user-inputted integer and prints out the value of pi to the number of decimal places specified by the integer. For example, if the inputted integer is '2' your program should print '3.14'.

Hints:

  • Python's math package includes a constant for pi (as pi). We have imported pi for you in the example code below.
  • The format string syntax for rendering a floating point value to N decimal places is {:.Nf}. The example code below prints pi to 10 decimal places.
  • You will first need to assemble a format string, and then print your result using that format string.

SAMPLE CODE:

from math import pi

# Example input() statement
n = int(input('Please enter an integer: '))

format_string = '{:.10f}'

# Replace this with your own print statement
print(format_string.format(pi))

In: Computer Science

Instructions:DevelopaprogramnamedMakeStudentsthat  Reads student data from Readme.txt and creates student instances o usetheStudentclassprovidedforthelab  Saves student...

Instructions:DevelopaprogramnamedMakeStudentsthat

  •  Reads student data from Readme.txt and creates student instances

    o usetheStudentclassprovidedforthelab

  •  Saves student instances in an array list

  •  Displays the size of the list

  •  Iterates through the list displaying students one student per line, as in:

    for (Student s: myList) { System.out.println(s);

    }

    new File("Readme.txt")).useDelimiter(",");

    Then to get each token we can use f.next() or f.nextBoolean()
    Note that student gender is of type char, and that char value can be obtained using

    f.next().charAt(0)

    YoumustusetheStudentclassgivenalongwiththislab. ThisversionofStudentissimpler than the one in the text – this version makes no reference to the Subject class (not needed for this lab).

    Your BlueJ project will include

    Readme.txt, Student.java, and MakeStudents.java

    SubmitMakeStudents.javatotheemailcorrespondingtoyourlabsectionwithsubject Lab 10

Copy the student data provided for this lab to Readme.txt. The data comprises comma-

separated values for fields: first name, last name, gender and active.

Previously we have used the Scanner class with its default delimiter of whitespace. In this

lab, use the Scanner class with comma as the delimiter:

Scanner f = new Scanner

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

public class Student {

// class fields

private static int lastId;

// instance fields

private int id;

private String firstName;

private String lastName;

private char gender;

private boolean active;

// first constructor, no arguments

public Student(){

id = nextId();

// default values for a student:

firstName = "unknown";

lastName = "unknown";

gender = '?';

active = false;

}

// second constructor, four arguments

public Student (String firstName, String lastName, char gender, boolean active){

id = nextId();

//

// when parameters and fields have the same

// name they are distinquished this way:

// a field name alone refers to the parameter

// a field name prefixed with "this."

// refers to an object's fields.

this.firstName = firstName;

this.lastName = lastName;

this.gender = gender;

this.active = active;

}

private int nextId(){

// increment lastId and return the new value

// to be used for the new student.

return ++lastId;

}

public int getId(){

return id;

}

public static int getLastId(){

return lastId;

}

public String getFirstName(){

return firstName;

}

public String getLastName(){

return lastName;

}

public char getGender(){

return gender;

}

public boolean isActive(){

return active;

}

public void setLastId(int newLastId){

lastId = newLastId;

}

// no setter for the student's id field

// public void setId(int newId){

// id = newId;

// }

public void setFirstName(String newFirstName){

firstName = newFirstName;

}

public void setLastName(String newLastName){

lastName = newLastName;

}

public void setGender(char newGender){

gender = newGender;

}

public void setActive(boolean newActive){

active = newActive;

}

public String toString(){

return id+" "+firstName+" "+lastName;

}

public boolean equals(Student s){

return id == s.id;

}

}

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

Readme.txt

Harry,Potter,m,true,Albus,Dumbledore,m,true,Serverus,Snape,m,true,Rubeus,Sirius,m,true,Hermione,Granger,f,true,Ron,Weasley,m,true,Draco,Malfoy,m,true,Luna,Lovegood,f,true,Regulus,Black,m,true,Neville,Longbottom,m,true,Nymphadora,Tonks,f,true,Remus,Lupin,m,true,Fleur,Delacour,f,true,Dolores,Umbridge,f,true,Gellert,Grindelwald,m,true

In: Computer Science

What domain expertise specific information is collected and organized during the problem definition step of a...

What domain expertise specific information is collected and organized during the problem definition step of a data mining spiral?

In: Computer Science

Marcia wants to keep track of each of her customers and their orders. Ultimately, she wants...

Marcia wants to keep track of each of her customers and their orders. Ultimately, she wants to notify them that their clothes are ready via email. Suppose that you have designed a database for Marcia’s Dry Cleaning that has the following tables:

CUSTOMER (CustomerID, FirstName, LastName, Phone, EmailAddress)

INVOICE (InvoiceNumber, CustomerID, DateIn, DateOut, Subtotal, Tax, TotalAmount)

INVOICE_ITEM (InvoiceNumber, ItemNumber, ServiceID, Quantity, UnitPrice, ExtendedPrice)

SERVICE (ServiceID, ServiceDescription, UnitPrice)

The referential integrity constraints are:

CustomerID in INVOICE must exist in CustomerID in CUSTOMER

InvoiceNumber in INVOICE_ITEM must exist in InvoiceNumber in INVOICE

ServiceID in INVOICE_ITEM must exist in ServiceID in SERVICE

Assume that CustomerID of CUSTOMER, EmployeeID of EMPLOYEE, ItemID of ITEM, SaleID of SALE, and SaleItemID of SALE_ITEM are all surrogate keys with values as follows: CustomerID Start at 100 Increment by 1

InvoiceNumber Start at 2018001 Increment by 1

D. Suppose that MArcia decides to allow multiple customers per order (e.g. for customers' spouses). Modify the design of these tables to accommodate this change.

E. Code SQL statements necessary to redesign the database, as described in your answer to question D.

F.Suppose that Marcia considers changing the primary key of CUSTOMER to (FirstName, LastName). Write correlated subqueries to display any data that indicate that this change is not justifiable.

In: Computer Science

IT Project Management: 1. Duration estimates are often provided as a discrete number, such as four...

IT Project Management:

1. Duration estimates are often provided as a discrete number, such as four weeks, or as a range, such as three to five weeks, or as a(n) ____________________.

2. Most projects have one path through a network diagram.

True or False

3. To make milestones meaningful, some people use the ____________________ criteria to help define them.

4. ____ involves analyzing activity sequences, activity resource estimates, and activity duration estimates to create the project schedule.

a. Estimating activity durations

b. Developing the schedule

c. Controlling the schedule

d. Estimating activity resources

5. ____ results in supporting detail to document important product information as well as assumptions and constraints related to specific activities.

a. Defining activities

b. Sequencing activities

c. Estimating activity resources

d. Estimating activity duration

In: Computer Science

*Answer must be in C* Write a program as follows: a- Define a structure type named...

*Answer must be in C*

Write a program as follows:

a- Define a structure type named "student" capable of storing the name of a student (string less than 15 characters long),

homework grade as float, and exam grade as a float.

b- Create an array of students named "cats" to store the info for 50 students.

c- Create a menu (and repeatedly display the menu) with three options:

option 1: enter the info for a student.

option 2: print the info of all students, do not print structures that have no hurricane data in them

option 3: exit program

d. write code to carry out each menu option

In: Computer Science

Regarding Operating Systems Researchers have suggested that, instead of having an access control list associated with...

Regarding Operating Systems

Researchers have suggested that, instead of having an access control list associated with each file (specifying which users can access the file, and how), we should have a user control list associated with each user (specifying which files a user can access, and how). Discuss the relative merits of these two schemes.

In: Computer Science

#Write a function called average_word_length that takes as #input a string called my_string, and returns as...

#Write a function called average_word_length that takes as
#input a string called my_string, and returns as output the
#average length of the words in the string.

In writing this function, note the following:
#
# - You should account for consecutive spaces. A string like
# "Hi Lucy" is two words with an average length of 3.0
# characters.
# - You should not assume the string starts with a letter.
# A string like " David" has one word with an average
# length of 5.0 characters.
# - You should not count punctuation marks toward the
# length of a word. A string like "Hi, Lucy" has two
# words with an average length of 3.0 characters: the ,
# after "Hi" does not count as a character in the word.
# The only punctuation marks you need to handle are
# these: . , ! ?
# - You may assume the only characters in the string are
# letters, the punctuation marks listed above, and spaces.
# - If my_string is not a string, you should instead return
# the string, "Not a string".
# - If there are no words in my_string, you should instead
# return the string, "No words". This could happen for
# strings like "" (an empty string) and ".,!?" (a string
# of only punctuation marks). You may assume that any
# of these punctuation marks will always be followed by
# at least one space.
#
#Here are a few hints that might help you:
#
# - You can peak at the first character in my_string with
# my_string[0]. If my_string is "Hi, Lucy", then the value
# of my_string[0] is "H". You don't have to do this, but
# you can if you want.
# - There are lots of ways you can do this. If you're
# stuck, try taking a step back and thinking about the
# problem from a fresh perspective.
# - If you're still stuck, try counting words and letters
# separately, and worrying about average length only
# after both have been counted.
# - The word count should equal the number of letters that
# come immediately after a space or the start of the
# string. The character count should simply equal the
# number of characters besides spaces and punctuation
# marks. The average word length should be character
# count divided by word count.

#Write your function here!
average_word_length(my_string)


#When your function works, the following code should
#output:
#2.0
#3.0
#4.0
#Not a string
#No words

print(average_word_length("Hi"))
print(average_word_length("Hi, Lucy"))
print(average_word_length(" What big spaces you have!"))
print(average_word_length(True))
print(average_word_length("?!?!?! ... !"))

In: Computer Science

1. Choose any model of the SDLC and analyze the tasks at each stage as described...

1. Choose any model of the SDLC and analyze the tasks at each stage as described below. Write at least one full paragraph for each stage of the SDLC including what it consists of and how you would apply that stage to the Case Study as described below.

Apply the Systems Development Life Cycle to the case described below. Choose any model of the Systems Development Life Cycle and analyze the tasks you would need to accomplish at each stage of the Systems Development Life Cycle for that model. You may use any of the SDLC models I gave you in the Lessons area in the Week 1 or Week 2 Lessons, or any other model of your own choice. However, be sure to state which model you are using and provide a URL to the resource(s) you consulted on that model so that I can compare your analysis of the case study against the specific Systems Development Life Cycle model that you chose for your analysis.

For example, if the model you follow has a Systems Initiation phase, you should explain to me how you would conduct the initial investigation. Who are the stakeholders that you would need to talk to? What information would you need to gather to establish the requirements of the project and how would you gather that information? What kind of feasibility study would you conduct and how would you do it? How would you conduct your cost-benefit analysis in this stage? What should be the end result of this stage?

You will have to identify the appropriate questions to ask yourself and to answer for each stage of your Systems Development Life Cycle, similar to what I have done for the Systems Initiation phase above. Part of this assignment is for you to understand and explain to me what needs to be accomplished in each phase and how that would specifically look for the Case Study below.

You must use your own general knowledge about organizations to make reasonable assumptions appropriate to the case study, since you will not be given every possible detail of the case. For example, who do you think the stakeholders would be? Think about the students, the faculty, the staff and administration of a typical university, etc., and identify all of the possible groups of stakeholders. You will have to think beyond the short description below and use your own general knowledge to complete the scenario and provide a full analysis of the Case Study.

2. Include details like specific questions and examples as indicated below.

Be as detailed as possible in your analysis. For example, if you are discussing how you would conduct a feasibility study, give a couple examples of specific questions you would ask. For another example, if you are describing how the Systems Design phase applies to the case study, include a couple examples of design items relevant to this case, such as an Entity Relationship Model for part of this system, or an example of a use case for your system, or the details of one or more classes you would create in this system. In this assignment, you are not required to create full design specifications, but you are encouraged to provide enough examples of design items to demonstrate your understanding of how you would approach the case study. For example, instead of delineating ALL classes you would need to create, choose one class and develop it as fully as you can, to illustrate that you understand the basics of creating an object class (with a class name, some class attributes, and some appropriate class methods).

***

Case Study

You are leading a team of software developers at a university. The university’s President has approached you about developing a new information system for tracking student course registrations. The system will need to contain information about students, faculty, and courses. Students should be able to use the system to browse course descriptions and the schedule of classes for each semester, add classes to their schedule, and drop classes from their schedule.

****

In: Computer Science

2. A vector is an ordered collection of values in mathematics. An array is a very...

2. A vector is an ordered collection of values in mathematics. An array is a very straightforward way to implement a vector on a computer. Two vectors are multiplied on an entry-by-entry basis, e.g. (1, 2, 3) * (4, 5, 6) = (4, 10, 18).
Write a program that include the following functions.
void multi_vec (int v1[], int v2[], int v3[], int n);
int comp_vec(int v1[], int v2[], int n);
The multi_vec function multiplies vectors v1 and v2 and stores the result in v3. n is the length of the vectors.
The comp_vec function compares v1 and v2, return 1 if vectors v1 and v2 are equal (their corresponding components are equal), and 0 otherwise. n is the length of the vectors.
In the main function, ask the user to enter the length of the vectors, declare two arrays with the length, read in the values for two vectors, and call the two functions to compute the multiplication and comparison of them. The main function should display the result.
Enter the length of the vectors: 5
Enter the first vector: 3 4 9 1 4
Enter the second vector: 5 7 2 6 8
Output:
The multiplication of the vectors is: 15 28 18 6 32
The vectors are not the same.

In: Computer Science

Python only please - Write a Python code to read a character (only one character) from...

Python only please - Write a Python code to read a character (only one character) from the user and check if it is a letter, digit, or a special character. Please see the sample runs below:

Sample Run 1

Enter a character: g

It is a letter

Sample Run 2

Enter a character: 7

It is a digit

Sample Run 3

Enter a character: @

It is a special character

In: Computer Science

Linked List Outlab Political RiffRaff Manager General Overview In case you missed it we just had an...

Linked List Outlab

Political RiffRaff Manager

General Overview

In case you missed it we just had an election and America is very divided I have decided you will write a program to select our politicians that take office in a fair and just way. We just went through a year of all the slimy politicians, and all the political supporters on both sides of the aisle coming out of the woodwork spouting their verbal abuse on each other. And even though the election is over the attacks and bitterness hasn't ended. Both sides are claiming "election foul".

You are going to fix it.  

 Every year ACM sponsors programming competitions at the local, regional and world levels. This assignment is adapted from a problem that appeared at one of these competitions...........very loosely adapted. 

Purpose

The purpose of the assignment is to give you experience implementing a circular, doubly linked list and all the methods and management that is needed for such a list. 

Problem Statement

In a serious attempt to downsize (reduce) the riffRaff in politics, The New Rhinoceros Party with the motto "we promise to keep none of our promises." has decided on the following strategy. Every day all Rhino applicants will be placed in a large circle, facing inwards. Someone is arbitrarily chosen as number 1, and the rest are numbered up to N (so N is the amount of candidates in the circle and N will be standing next to 1  as the end of the potential candidates).

Now you will have two officials that will be the selectors, selector one holds a number we will call k, official two has a number we will call m. Selector k will start at candidate 1 (first candidate) and will move around the circle of candidates clockwise counting off candidates until it counts k candidates and then stop pointing at the kth candidate.

Selector m will start at candidate N (last candidate) and will move around the circle of candidates counter-clockwise counting off candidates until it gets to the mthcandidate. 

Now one of two things will have taken place, the selectors will be pointing at two different candidates, or they will be pointing at the same candidate. If the selectors are pointing to two different candidates we will remove the candidates from the circle of candidates (these candidates will be ELIMINATED), starting with k candidate first and then the m candidate. The k selector will need to move clockwise up to the next available candidate and prepare to start counting again. The m selector will do the same but it will always move counter-clockwise. After removal the two selectors will need to be ready to start counting again at the next available candidate.  

If both selectors stop and they are pointing to the same candidate we have found ourselves a worthy candidate that will be put into political office.......keep this candidate off to the side, but remove the candidate from the circle of candidates.......which means k selector will need to be moved clockwise to next available and m selector will need to be moved counterclockwise to the next available candidate. 

Each selector then starts counting again at the next available person and the process continues until no-one is left. Note that the two victims (sorry, trainees) leave the ring simultaneously, so it is possible for one official to count a person already selected by the other official.

Input File Format

Write a program that asks the user for the name of a valid input file. If the file exists, the program should read in (in that order) the three numbers (N, k and m; k, m > 0, 0 < N < 100) and determine the order in which the applicants are sent off for political retraining. Each set of three numbers will be on a separate line and the end of data will be signaled by three zeroes (0 0 0).

Here is a sample input file:

10 4 3
17 6 4
0 0 0

Output Requirements

The output should be sent to a file named LinkedListProgram.txt. For each input, the output should show the order in which the people are chosen. For each round in which two different people are chosen, list the person chosen by the counter-clockwise official first.

Here is the required output for the an input file:

Program 4
---------

N = 10, k = 4, m = 3

Output
------
4 8
9 5
3 1
2 6
10
7

End of Program 4

(Note: There seems to be an error in either the output or the instructions, because I cannot get get this exact output from the instructions given. Editing the code to make it match the output is fine.)

Requirements and Grading

12 points. You are required to design and implement your own linked list (in the style of what we have done in lecture this week) as opposed to using a built-in class provided by Java. The class you use should be doubly-linked (6 points), circular (3 point) and if it works of course(3 point).12 points. The program finds the correct answer. Your TA will test your program on some sample files after the assignment is due. Thus, please test your program thoroughly before submitting it.6 points. The program finds the solution in a reasonably efficient manner. For example, if N = 10, k = 1 and m = 450, the m judge should not circle around the candidates needlessly.5 points. The program sends it output to a file named LinkedListProgram.txt5 points. The program's output matches the required output format described above.10 points. The program uses good style. This includes factors such as appropriate commenting, good object oriented design, readable code that is high quality, etc.

In: Computer Science

Perform the following calculations using 2s complement arithmetic. Indicate overflow where applicable. a. 14 + 2...

Perform the following calculations using 2s complement arithmetic. Indicate overflow where applicable.

a. 14 + 2 using 5 bits precision
b. 14 - 6 using 6 bits precision
c. 62 + 2 using 6 bits precision
d. -15 - 10 using 8 bits precision
e. 125 + 2 using 8 bits precision

In: Computer Science

24. Determine whether each of the P-boxes with the following permutation table is a straight P-box,...

24. Determine whether each of the P-boxes with the following permutation table is a straight P-box, a compression P-box, or an expansion P-box. Detail your reason.    

a). P-box:   

1 1 2 3 4 4

b). P-box:

1 3 5 6 7

In: Computer Science