Questions
There will be three grades for each student in "grades.txt" (see example file bellow). In "student.txt"...

There will be three grades for each student in "grades.txt" (see example file bellow). In "student.txt" there are two students first and last names. In "grades.txt" the grades for each student will be on the same line number as the students name was on in "students.txt".

So if line 1 of "students.txt" contains:

Joe Blow

then line 1 of "grades.txt" would contain Joe Blow's grades:

85 54.3 56

Into an output file called "report.txt" output the student's last name then a comma the their first name. Following this, calculate their average and assign a letter grade using the following scale:

'A': grade >= 90

'B': 90 > grade >= 80

'C': 80 > grade >= 70

'D': 70 > grade >= 60

'F': grade < 60

If the final grade of a student is greater than 100 instead of printing their letter grade output the statement "Teacher was far too easy". The "report.txt" should have a heading on each of the columns the first saying "Student's Name" and the second saying "Student's Grade".

In: Computer Science

Please write a JAVA program which reads a number n from the user and check whether...

Please write a JAVA program which reads a number n from the user and check whether n is a perfect number or not. For example, when n = 7, the print out should be 7 is not a perfect number. If the input n is 6, then the program prints out 6 = 1 * 2 * 3

In: Computer Science

Show what is written by the following segment of code, given item1, item2, and item3 are...

Show what is written by the following segment of code, given item1, item2, and item3 are int variable:

item1 = 4;

item3= 0;

item2 = item1 + 1;

stack.Push(item2);

stack.Push(item2 +1);

stack.Push(item1);

item2 = stack.Top();

stack.Pop();

item1 = item2 + 1;

stack.Push(item1);

Stack.Push(item3);

while (!stack.IsEmpty())

{

     item3 = stack.Top():

     cout <<item3<<endl;

     stack.Pop();

}

cout<<item1 <<endl <<item2<<endl<<item3<<endl;

In: Computer Science

The Monty Hall problem solved on Matlab. Please show code. You are given a choice between...

The Monty Hall problem solved on Matlab. Please show code. You are given a choice between three doors. Behind one door is a new car and behind the other two doors is a goat. You first pick one of the doors at random. Then, a door with a goat is opened for you. You are then given the option to switch your door to the other unopened door. Should you do this? What are your odds of winning if you switch vs not switching? Show using matlab with a large number of runs, where you keep your selection 50% of the time and switch 50% of the time.

In: Computer Science

Given a generic array with ‘n’ items (not only integers). Give a solution for checking whether...

Given a generic array with ‘n’ items (not only integers). Give a solution for checking whether there are any duplicate elements in the array or not? You just need to return a boolean (true or false). State the complexity of your solution. Can you come up with another solution that has O(n logn) complexity? Explain.

In: Computer Science

Write a program to simulate an experiment flipping three coins. Each time the three coins are...

Write a program to simulate an experiment flipping three coins. Each time the three coins are flipped, is called a “trial”. A coin flip can randomly result in either “Heads” (1) or “Tails” (0) Allow the user to enter the number of “trial”s to simulate. Print out each coins’ result after each “trial”. Use seed value 1234. Tally up and determine what percentage of “trial”’s all three coins land on “Heads” in the simulation. C language

In: Computer Science

In MATLAB write a function secant.m to apply the secant method. function [x,i] = secant(f, x0,...

In MATLAB write a function secant.m to apply the secant method.

function [x,i] = secant(f, x0, x1, tol, maxiters)

[x,i] = secant(f, x0, x1, tol, maxiters) performs the secant method with f(x), starting at x_0 = x0 and x_1 = x1, and continuing until either |x_i+1 - x_i| <= tol, or maxiters iterations have been taken. The number of iterations, i, is also returned. An error is raised if the first input is not a function handle. A warning is raised if the maximum number of iterations is reached without achieving the tolerance.

Test the function on the problem f(x) = 0.9 cos(x) - sqrt(x) = 0, with starting values x0 = 0 and x1 - 1, and a tolerance of 10^-8 and maxiters of 20.

In: Computer Science

Write a C function to calculate and return the factorial value of any positive integer as...

Write a C function to calculate and return the factorial value of any positive integer as an
argument. Then call this function from main() and print the results for the following input
values:
2, 3,4, 5, 10, 15
What is the maximum value of an integer for which factorial can be calculated correctly on a
machine using your algorithm?

In: Computer Science

In c++ This question is relevant if you implemented a polynomial that included some calculus-based operations...

In c++

This question is relevant if you implemented a polynomial that included some calculus-based operations such as derivative and integral. Write a new function that meets the following specification:

double slope(const polynomial& p, double x)

// POSTCONDITION: The return value is equal to the slope of the

// polynomial p, evaluated at the point x.

In: Computer Science

import java.util.Scanner; public class Grade { public static void main(String[] args) { Scanner scnr = new...

import java.util.Scanner;

public class Grade {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);

// Reading score from user
System.out.println("Enter the student's score:");
double score = scnr.nextDouble();

System.out.print("Grade:");
// Checking if score is less than 60
if(score<60){
System.out.println("F");
}
// Checking if score is less than 70
else if(score<70){
System.out.println("D");
}
// Checking if score is less than 80
else if(score<80){
System.out.println("C");
}
// Checking if score is less than 90
else if(score<90){
System.out.println("B");
}
// Checking if score is less than 100
else {
System.out.println("A");
}
}
}

I need this codes output to say

Enter the student's score:

A

and mine says

Enter the student's score:

Grade: A

How do I fix that in my code?

In: Computer Science

Java program Bounds checking Make an array {4, 6, 2, 88, 5}, ask the user what...

Java program

Bounds checking

Make an array {4, 6, 2, 88, 5}, ask the user what number they would like to change. If their pick is out of bounds, tell them. Otherwise ask them what they would like to change the number to. After the change, display all the numbers with a for loop

In: Computer Science

Using SQL, answer the following question referring to the table below How many twins are there?...

  1. Using SQL, answer the following question referring to the table below
    1. How many twins are there? (Just having the same birthday does not make you twins.)
    1. Name the twins.

CREATE TABLE IF NOT EXISTS students (

student_id INT NOT NULL AUTO_INCREMENT,

first_name VARCHAR(16),

last_name VARCHAR(24),

birthday DATE,

street_address VARCHAR(128),

city VARCHAR(32),

PRIMARY KEY (student_id));

INSERT INTO students

(first_name, last_name, birthday, street_address, city) VALUES

('John','Jones','2000-12-17','250 Pines Blvd.','Pembroke Pines'),

('Mark','Bacon','2000-04-12','1270 Walnut St.','Prarie Bluff'),

('Bill','Carlson','1999-07-06','250 Pines Blvd.','Pembroke Pines'),

('Jean','Carlson','1999-07-06','250 Pines Blvd.','Pembroke Pines'),

('Leonard','Cook','2000-09-14','8046 Maple St.','Highland Park'),

('William','Markham','1999-07-06','1600 Sylvan Ln.','Lake Forest'),

('Sam','Cook','1998-10-13','8046 Maple St.','Highland Park'),

('Fred','Williams','1999-07-08','722 Oack Knoll','Arlington'),

('Sally','Fillmore','2000-03-25','1215 Carrington St.','Decatur'),

('Mary','Jones','1999-11-13','1940 Grant St.','Denver'),

('Phyllis','Jones','1999-11-13','1940 Grant St.','Denver');

In: Computer Science

Create a class Client. Your Client class should include the following attributes: Company Name (string) Company...

Create a class Client. Your Client class should include the following attributes:

Company Name (string)

Company id (string)

Billing address (string)

Billing city (string)

Billing state (string)

Write a constructor to initialize the above Employee attributes.

Create another class HourlyClient that inherits from the Client class.   HourClient must use the inherited parent class variables and add in hourlyRate and hoursBilled. Your Hourly Client class should contain a constructor that calls the constructor from the Client class to initialize the common instance variables but also initializes the hourlyRate and hoursBilled. Add a billing method to HourlyClient to calculate the amount due from a service provided. Note that billing amount is hourlyRate * hoursBilled

Create a test class that prompts the user for the information for five hourly clients, creates an arraylist of 5 hourly client objects, display the attributes and billing for each of the five hourly clients. Display the company name and billing amount for each company and the total billing amount for all five companies.

Remember to submit your pseudocode algorithm

In: Computer Science

can u give me an example of how to removing Double Linked List a node at...

can u give me an example of how to removing Double Linked List a node at a given location in java

the method should be like this:

public void removeFromLocation(int location) {

}
      
      
      
      
   }

In: Computer Science

Problem Statement Josephus attended a party where they had a rather strange raffle. Everyone was to...

Problem Statement

Josephus attended a party where they had a rather strange raffle. Everyone was to stand in a circle, and every Mth person was to be eliminated until only one person was remaining, who won the lawnmower.

Write the function Josephus, which takes as parameters a vector<string> representing the N guests at the party in the order they line up for the raffle, and the integer M, giving which person will be eliminated at each turn. Your function should return a string giving the name of the winner of the raffle (the last person standing).

Hint: While there is a mathematical solution, a queue will be much more straightforward.

Constraints

  • N, the length of the vector<string> guests, will be greater than 0 and less than 2,000.
  • M will be greater than zero and less than 2,000.

Examples

  1. guests = {"Josephus", "Titus", "Simon", "Eleazar"}
    M = 3 
    Returns: "Josephus"

    Counting every third person from Josephus (remember, they are in a circle), Simon is eliminated first. Skipping Eleazar and Josephus, Titus goes next. Skipping Eleazar and Josephus, we come back to Eleazar. Josephus, who cleverly suggested M = 3, comes out the winner!

  2. guests = {"Bradford", "Rosette", "Ji", "Ashleigh", "Avery", "Lavonna", "Fredericka"} 
    M = 2 
    Returns: "Fredericka"
  3. guests = {"Tiffany", "Randy", "Kit", "Sharlene", "Marquerite", "Debra", "Pok", "Tanisha", "Claudio"} 
    M = 17 
    Result: "Debra"

Given Function

string Josephus(vector<string> guests, int M) {
// your code here
}

Use the given function to solve the problem statement. Please follow the given notes and constraints. Please code this problem in C++.

In: Computer Science