Questions
Using C# Design and implement a program (name it CheckPoint) that prompts the user to enter...

Using C# Design and implement a program (name it CheckPoint) that prompts the user to enter the x-coordinate then y-coordinate of a point (in a Cartesian plane) as integer values. The program prints out the entered values followed by the location of the point on the plane. The possibilities for a point are: the origin point, on the x-axis, on the y-axis, in the first quadrant, in the second quadrant, in the third quadrant, or in the fourth quadrant. Format the outputs following the sample runs below.

Sample run 1:

X-coordinate is 0

Y-coordinate is 0

(0, 0) is the origin point.

In: Computer Science

1. Introduction This assignment will give you some experience working with C input (using scanf()) and...

1. Introduction

This assignment will give you some experience working with C input (using scanf()) and output (using printf()), as well as arithmetic operations with variables. You will do some very basic circuit analysis, reading the values of a voltage source and three resistors, and calculating the voltage across and current through each of the resistors using three different circuit configurations.

Test cases for the program can be found at this link.

Remember, in addition to submitting your code, you MUST complete the Blackboard assignment "Program 2 style assessment" to get all of the points for this program. You can complete this "assignment" by typing a short message indicating you submitted your code through the textbook IDE.

2. Specification

Note that this specification refers to several figures, which can be found at the following link: Program 2 figures

In this program, you will deal with the three resistive circuits in Figure 1: a series circuit, a parallel circuit, and a circuit using resistors both in series and in parallel.

Those of you who are familiar with basic DC circuit analysis should be able to easily derive the voltage across and current through each resistor. For more details and equations, please see the Circuit Analysis Supplement in the Program 2 figures document.

Input Specification

Your program should prompt the user to enter the values of Vsource (in volts) and R1, R2, and R3 (in ohms). The source voltage should be entered on one line, while all three resistance values should be entered on a second line. (Note: remember, scanf() ignores whitespace when scanning numbers—you do not have to explicitly worry about varying numbers of spaces.)

The program could produce the first two lines below (the numbers are user inputs, not program outputs):

Enter voltage source value (V):  10
Enter three resistance values (ohms):  5 10 10

All input values should be treated as double-precision floating point values.

Output Specification

Once the voltage and resistance values have been read, you should print the following information for each circuit, as shown below:

  • A blank line (to separate each circuit description)
  • A brief circuit description (e.g., “SERIES CIRCUIT”)
  • The voltage across each resistor. Note that, in the parallel circuit, the voltage across each resistor is the same and should only be printed once.
  • The current through each resistor. Note that, in the series circuit, the current through each resistor is the same and should only be printed once.

See the Circuit Analysis Supplement in the Program 2 figures document for more details on determining the appropriate voltage and current through each resistor if you are unfamiliar with the analysis used. The output lines that would follow the example shown above would be:

SERIES CIRCUIT
Current through circuit:  0.400000 A
Voltage across R1:  2.000000 V
Voltage across R2:  4.000000 V
Voltage across R3:  4.000000 V

PARALLEL CIRCUIT
Voltage across each resistor:  10.000000 V
Current through R1:  2.000000 A
Current through R2:  1.000000 A
Current through R3:  1.000000 A

R2 & R3 IN PARALLEL
Voltage across R1:   5.000000 V
Current through R1:  1.000000 A
Voltage across R2:   5.000000 V
Current through R2:  0.500000 A
Voltage across R3:   5.000000 V
Current through R3:  0.500000 A

See the posted test cases for more sample program runs.

3. Hints

Order of operations

C operators follow the same order of operations you likely learned for basic arithmetic operations—multiplication and division take precedence over addition and subtraction. Parentheses have higher precedence than any of these operators. So, for example, if x = 5, y = 2, and z = 3:

  • x + y * z = 5 + 2 * 3 = 5 + 6 = 11
  • (x + y) * z = (5 + 2) * 3 = 7 * 3 = 21
  • x + y / 2 = 5 + 2 / 2 = 5 + 1 = 6

Variables and expressions

Variables should be used to store values that are used more than once to avoid repeating calculations. For example, you could improve the following code by creating a variable to hold the value a + 2:

x = (a + 2) * 3;
y = 5 / (a + 2);
z = (a + 2) – (a + 2);

Values used only for output do not need variables, since printf() can print the value of any expression. Each of the following lines is therefore a valid use of this function. Assume you have variables int n and double x:

  • printf("n squared: %d, n cubed: %d\n", n * n, n * n * n);
  • printf("17/x + 35n = %lf\n", (17 / x) + (35 * n));
  • printf("Rectangle with length %d, width %lf has area %lf\n", n, x, n * x);

4. Grading Rubric

For this assignment, points are assigned as follows:

  • 40 points: Your code uses appropriate coding style such as including appropriate comments, indenting the main() function body, and appropriate variable declarations. You must complete the Blackboard assignment "Program 2 style assessment" to earn any of these points.

  • 60 points: Your code compiles and output matches the desired test outputs shown below. Each test case has a different number of points assigned to it, as shown in submit mode.
    This section will be auto-graded, while I will assign the other 40 points after inspecting your program.

In: Computer Science

write a two-to-three-page paper describing cyberwarfare and ways our government protects our own national infrastructure.

write a two-to-three-page paper describing cyberwarfare and ways our government protects our own national infrastructure.

In: Computer Science

Write down a C program which will create a list (simple linear linked list) of nodes....

Write down a C program which will create a list (simple linear linked list) of nodes. Each node consists of two fields. The first field is a pointer to a structure that contains a student id (integer) and a grade-point average (float). The second field is a link. The data are to be read from a text file. Your program should read a file of 10 students (with student id and grade point average) and test the function you wrote (by printing student’s information on screen). (Please comment the codes)

In: Computer Science

You have been asked to build a database for a pet foster and adoption shelter. The...

You have been asked to build a database for a pet foster and adoption shelter. The agency is a non-profit that takes in stray or abandoned pets and places them with foster care givers until the pet is adopted. Foster care givers are volunteers, though they must first be screened. The database needs to track all animals in its care, their species, breed, name and condition. It also needs to track all approved foster care givers and which animals are currently in their care. Foster care givers are also supposed to turn in monthly reports on the animals in their care. The database also needs to track the adoptions of the animals. Currently, volunteers come into the shelter and fill out a paper form. After a background check they are added to a file. Some volunteers complain that they are never contacted again. The shelter staff admits, they tend to go with foster care givers they know and some people get forgotten in the file. The shelter has also occasionally lost track of an animal in foster care when the care giver failed to turn in the monthly reports. Another recurring problem is that when someone comes into the shelter looking to adopt, it is not always easy or even possible to let them know about all the animals available for adoption. Ideally the shelter would like people to be able to register as a volunteer on-line. They would like to be able to call up a list of all available foster volunteers. They also would be like to be able to pull up all the animals of the kind a potential adopter is interested in and know exactly where those animals are and who is caring for them.

Would animals be stakeholders in this database? Explain why or why not.
What might be some of the shelter database security issues?

In: Computer Science

#include<iostream> #include<string> #include<fstream> #include<vector> /*HW: Create two more functions, Modify the posted grade example that uses...

#include<iostream>

#include<string>

#include<fstream>

#include<vector>

/*HW: Create two more functions,

Modify the posted grade example that uses dynamic arrays and file I/O to include the following:

-Use vectors
-read from values from the file and store them in the vector. Modify the function getGrades

Extend the program to also include the following features:

-A menu option that allows the user to add more students and there grades. Assume the number of quizzes stay the same based on the value read from the file
-A menu option that allows the user to display all students that were added and their grades. As well as, the average of the quizzes and the average of the student
-A menu option to search for a student by ID, the program must display the student ID, and the student grades
-An option to exit.

Make sure the new students added to the vector are stored in the original file that you read from. Hence, if you exit the program and run it again, the new students added will show in your new run of the program.*/  

using namespace std;

//Don't forget to pass sid and grade by reference

void getGrades(ifstream &fin, vector<string> &sid, vector<vector<double>> &grade, int num_stud, int NUM_Q)

{

       for (int i = 0; i<num_stud; i++)

       {

              string tempId;

              double sgradetemp;

              fin >> tempId;

              sid.push_back(tempId);

              vector<double>sgradetempv;

              fin >> sid[i];

              for (int j = 0; j < NUM_Q; j++)

              {

                     fin >> sgradetemp;

                     //Vector of values

                     sgradetempv.push_back (sgradetemp);

              }

              //Vector of a vector

              grade.push_back(sgradetempv);

       }

}

void compute_st_ave(vector<vector<double>> grade, vector<double> &st_ave, int num_stud, int NUM_Q)

{

       for (int s = 0; s<num_stud; s++)

       {

              double sum = 0;

              for (int q = 0; q<NUM_Q; q++)

              {

                     sum = sum + grade[s][q];

              }

              st_ave.push_back (s = sum / NUM_Q);

       }

}

void compute_q_ave(vector<vector<double>>grade, vector<double>quiz_ave, int num_stud, int NUM_Q)

{

       for (int q = 0; q<NUM_Q; q++)

       {

              double sum = 0;

              for (int s = 0; s<num_stud; s++)

              {

                     sum = sum + grade[s][q];

              }

              quiz_ave.push_back(q = sum / num_stud);

       }

}

void saveToFile(vector<string> sid, vector<vector<double>>grade, vector<double>st_ave, vector<double>quiz_ave, int num_stud, int NUM_Q)

{

       ofstream fout("results.txt");

       fout << "Dispalying the results" << endl;

       fout << "\t\t\t\tAverage" << "\t\t" << "Quizzes\n";

       for (int s = 0; s<num_stud; s++)

       {

              fout << "Student " << sid[s] << ":\t" << st_ave[s] << " \t\t";

              for (int q = 0; q<NUM_Q; q++)

              {

                     fout << grade[s][q] << "\t";

              }

              fout << endl;

       }

       fout << "Quiz Average: \t\t\t";

       for (int q = 0; q<NUM_Q; q++)

       {

              fout << "\t" << quiz_ave[q] << " ";

       }

       fout << endl;

       fout.flush();

       fout.close();

}

int main()

{

       int NUM_STUD, NUM_Q;

       ifstream fin("grades.txt");

       fin >> NUM_STUD >> NUM_Q;

       /*

       string *sid = new string[NUM_STUD];

       double **grade = new double *[NUM_STUD];

       for (int i = 0; i < NUM_STUD; i++)

       {

              grade[i] = new double[NUM_Q];

       }

       double *st_ave = new double[NUM_STUD];

       double *quiz_ave = new double[NUM_Q];

       */

      

       vector<string>sid;

       vector<vector<double>>grade;

       vector<double> st_ave;

       vector<double>quize_ave;

       getGrades(fin, sid, grade, NUM_STUD, NUM_Q);

       compute_st_ave(grade, st_ave, NUM_STUD, NUM_Q);

       compute_q_ave(grade, quiz_ave, NUM_STUD, NUM_Q);

       saveToFile(sid, grade, st_ave, quiz_ave, NUM_STUD, NUM_Q);

       fin.close();

       system("pause");

       return 0;

}

In: Computer Science

Test Your Understanding Create a JAVA package by name ClassEx2 and in the main() method of...

Test Your Understanding

Create a JAVA package by name ClassEx2 and in the main() method of
the class, assign your name to a String object and your father name to a
different String object and do the following;

Concatenate your name and your father name.

Get the length of your full name.

Find the index of any character in your full name.

Replace the occurrence of any lower case character in your full
name to capital character.

Compare your first name with your father name , display message
indicating which name is first lexicographically.

In: Computer Science

In Python write a function that simulates the throwing of any even numbered dice which will...

In Python write a function that simulates the throwing of any even numbered dice which will be passed on as a parameter: customDice(sides). The function will return a random number rolled for that particular type of dice. Write the program that will utilize the customDice function with the following specification: Ask the user to pick which even-sided dice to use. The program will then roll the dice twice. If the total of both rolls is greater than the number of die sides+1, then they lose. If not, they win. Write statements that prompt the user for the type of dice to use, print the value from the two rolls and a message whether they win or lose. If the user enters an odd number, ask for the input again.

Sample dialogs:

Please choose an even-sided dice: 3

Sorry, it must be an even-sided dice.

Please choose an even-sided dice: 10

Roll 1: 3

Roll 2: 10

Total: 13

You lose (13 > 11)!

Please choose an even-sided dice: 8

Roll 1: 3

Roll 2: 2

Total: 5

You win (5 < 9)!

In: Computer Science

Consider a circuit-switching scenario in which Ncs users, must share a link of capacity 150 Mbps....

Consider a circuit-switching scenario in which Ncs users, must share a link of capacity 150 Mbps. Each user alternates between periods of activity when the user generates data at a constant rate of 20 Mbps and periods of inactivity when he generates no data. Suppose further that he is active only 20% of the time. Assume a circuit switched TDM. What is the maximum number of circuit-switched users that can be supported? Assume packet switching is used for the remaining parts of this question. Suppose there are 13 packet- switching users (i.e., Nps = 13). Can this many users be supported under circuit-switching? Explain. What is the probability that a given (specific) user is transmitting, and the remaining users are not transmitting? What is the probability that one user (any one among the 13 users) is transmitting, and the remaining users are not transmitting? When one user is transmitting, what fraction of the link capacity will be used by this user? What is the probability that any 7 users (of the total 13 users) are transmitting and the remaining users are not transmitting? (Hint: you will need to use the binomial distribution.) What is the probability that more than 7 users are transmitting? Comment on what this implies about the number of users supportable under circuit switching and packet switching. What is the probability that more than 7 users are transmitting? Comment on what this implies about the number of users supportable under circuit switching and packet switching.

In: Computer Science

I am struggling to write a python script that calculates the average length ,max length shortest...

I am struggling to write a python script that calculates the average length ,max length shortest length and overall average length of of a snake and ladder game. I use python 3
The length is the number the dice is rolled until the max is reached

We need a python script that calculates the number of moves it will take for a single player to reach 100. We have to simulate a snake and ladder game using python language. So one person plays the game several times and will compare the number of moves per each played game for us to be able to come up with the required data

In: Computer Science

describe and discuss the Software Development Life Cycle as it relates to creating software that will...

describe and discuss the Software Development Life Cycle as it relates to creating software that will calculate the totals and dispense change for a cash register at a local grocery store

In: Computer Science

Ask the user to enter test scores. Once they have entered -1, print out the highest...

Ask the user to enter test scores. Once they have entered -1, print out the highest grade. Ensure that the grade entered is an integer.(Using Java Language)

Enter integers between 0 and 100, -1 when finished.

Enter a test score: [asdf]

Enter an integer.

Enter a test score: [32.5]

Enter an integer.

Enter a test score: [42]

Enter a test score: [99]

Enter a test score: [87]

Enter a test score: [x]

Enter an integer.

Enter a test score: [-1]

The max grade is: 99

In: Computer Science

c++ For your program, you will choose either the Selection Sort algorithm or the Insertion Sort...

c++

For your program, you will choose either the Selection Sort algorithm or the Insertion Sort algorithm and create a recursive implementation of that algorithm. Your program should:

  1. Randomly generate an array of at least 20 values.
  2. Display the contents of that (unsorted) array.
  3. Use the recursive implementation of either Selection or Insertion Sort to sort the values.
  4. Display the contents of the now sorted array, to demonstrate the success of the algorithm.

In: Computer Science

In C language Write a program that includes a function search() that finds the index of...

In C language

Write a program that includes a function search() that finds the index of the first element of an input array that contains the value specified. n is the size of the array. If no element of the array contains the value, then the function should return -1. The program takes an int array, the number of elements in the array, and the value that it searches for. The main function takes input, calls the search()function, and displays the output. Name program part1.c

int search(int a[], int n, int value);

Example 1:

Enter length of array: 4

Enter elements of array: 8 2 3 9

Enter the value for searching: 2

Output: 1

Example 2:

Enter the length of the array: 6

Enter the elements of the array: 4 6 1 0 2 9

Enter the value for searching: 5

Output: -1

2. Modify the part 1 program so that it deletes all instances of the value from the array. As part of the solution, write and call the function delete() with the following prototype. n is the size of the array. The function returns the new size of the array after deletion (The array after deletion will be the same size as before but the actual elements are the elements from index 0 to new_size-1). In writing function delete(), you may include calls to function search(). The main function takes input, calls the delete()function, and displays the output. Name your program part2.c.

int delete(int a[], int n, int value);

Example 1:

Enter the length of the array: 6

Enter the elements of the array: 4 3 1 0 3 9

Enter the value for deleting: 3

Output array:

4 1 0 9

In: Computer Science

There are several typical cube computation methods such as Multi-Way, BUC, and Star-cubing. Briefly describe each...

There are several typical cube computation methods such as Multi-Way, BUC, and Star-cubing. Briefly describe each one of these methods outlining the key points.

In: Computer Science