Write a C program that calculates the percent saves for a hockey
goalie for 4 games and
the overall percentage of saves which is saves divided by the sum
of goals plus saves.
input->process->output->repeat
The program should prompt the user to enter the number of goals and
the number of
saves for each of the 4 games. The program should then calculate
and display the percent
saves obtained for each game. Once processing is complete for the
games, the program
will calculate the overall percent saves (total saves / sum of
total saves and total goals
and display the results. Then print a friendly exit message as
shown below.
Once you create, compile, link and run your program, your program
should present the
following input/output dialog to the user:
Welcome to the Goalie Saves Analysis
This program will calculate the percentage of saves for
a hockey goalie for 4 games after you have entered the
games and saves for the goalie.
Enter the number of goals for game #1: 3
Enter the number of saves for game #1: 22
The percent saves for game #1 is 88.0%
Enter the number of goals for game #2: 4
Enter the number of saves for game #2: 33
The percent saves for game #2 is 89.2%
Enter the number of goals for game #3: 1
Enter the number of saves for game #3: 16
The percent saves for game #3 is 94.1%
Enter the number of goals for game #4: 0
Enter the number of saves for game #4: 22
The percent saves for game #4 is 100.0%
The percent saves for 4 games for this goalie is 92.1%
Thanks for using the Bruins Goalie Saves Analysis
program.
In: Computer Science
Explain about the role of "bus" in Von Neumann architecture. Why a slow bus-speed can cause a performance-bottleneck in Von Neumann architecture?
In: Computer Science
Advanced Inheritance Concepts (Exercise 7)
The Cullerton Park District holds a mini-Olympics each summer. Create a class named Participant with fields for a name, age, and street address. Include a constructor that assigns parameter values to each field and a toString() method that returns a String containing all the values. Also include an equals() method that determines two participants are equal if they have the same values in all three fields.
Create an application with two arrays of at least eight participants each—one holds participants in the mini-marathon, and the other holds participants in the diving competition. Prompt the user for participant values. After the data values are entered, display values for participants who are in both events.
Participant.java
public class Participant
{
// private variables here
public Participant(String n, int a, String add)
{
// constructor code here
}
public String getName()
{
// method code here
}
public int getAge()
{
// method code here
}
public String getAddress()
{
// method code here
}
public String toString()
{
// method code here
}
public boolean equals(Participant p)
{
// method code here
}
}
TwoEventParticipant.java
import java.util.*;
public class TwoEventParticipants
{
public static void main(String[] args)
{
Participant marathoners[] = new Participant[8];
Participant divers[] = new Participant[8];
int i, j;
String name;
int age;
String address;
Scanner input = new Scanner(System.in);
System.out.println("Enter mini-marathon participants");
for(i = 0; i < marathoners.length; ++i)
{
System.out.print("Enter name: ");
name = input.nextLine();
System.out.print("Enter age: ");
age = input.nextInt();
input.nextLine();
System.out.print("Enter address: ");
address = input.nextLine();
marathoners[i] = new Participant(name, age, address);
}
System.out.println("\nEnter diving participants");
for(i = 0; i < divers.length; ++i)
{
System.out.print("Enter name: ");
name = input.nextLine();
System.out.print("Enter age: ");
age = input.nextInt();
input.nextLine();
System.out.print("Enter address: ");
address = input.nextLine();
divers[i] = new Participant(name, age, address);
}
System.out.println("\nParticipants who are in both events:");
for(i = 0; i < marathoners.length; ++i)
for(j = 0; j < divers.length; ++j)
if(marathoners[i].equals(divers[j]))
System.out.println(marathoners[i].toString());
}
}
Possible Answer:
Participants who are in both events:
Participant_2
10
Apartment No. 2
Participant_6
13
Apartment No. 6
Participant_7
13
Apartment No. 7
In: Computer Science
Complete the following assignment in C programming language.
In: Computer Science
Reserved words are keywords which will not be used for identifier. For example, Java reserved words include for, while, if and etc. What are the disadvantages of having “too many reserved words”?
In: Computer Science
Q. Operating systems are the most indispensable components of the software interface between users and the hardware of their computer systems. Explain.
In: Computer Science
Create a class that has a method that uses the ‘this’ keyword as the return statement. This method (called increment( ) in the class that you have just created ) increments the private integer field (private i ) in the class. In the main ( ) method, if you increment (using the ‘this’ with increment() call) four times, you should see the following display:
i is = 4
Thank You
In: Computer Science
Python to analyze weather data from a file. First, go to this Minnesota Dept. of Natural Resources web page, which displays weather data for Minneapolis on each day of the year 2000. Click the CSV link to download a file containing the data. The file is a “comma-separated values” text file of weather data. The first few lines look like this:
"Date","Maximum Temperature degrees (F)","Minimum Temperature... "2000-01-01","35.0","24.0","T","0.00","0.00" "2000-01-02","35.0","29.0","0.04","0.50","0.00" "2000-01-03","29.0","24.0","T","T","0.00"
The first line of the file contains column headings, and each of the remaining lines contain weather data for one specific day. These lines contain a date followed by the high temperature, low temperature, precipitation, snowfall, and snow depth recorded on that day. A value of “T” indicates a “trace” amount of precipitation or snowfall, which you can regard as zero.
Write some Python code to load the data from the file into one or more NumPy arrays. Then compute the following:
Compute the average high and low temperatures for each month. For example, the average high temperature for January is the average of the high temperatures for all 31 days in January.
Compute the number of days each month that received no precipitation. (Regard a “trace” amount of precipitation as zero precipitation.)
Compute the total snowfall for each month. (Again, regard a “trace” amount as no snowfall.)
Find the day that had the greatest difference between the high and low temperature for that day.
In: Computer Science
Does IPv6 provide similar functionality for DHCP, NAT, and PAT? Explain.
Does IPv6 support similar security associated with these technologies? Explain.
In: Computer Science
In: Computer Science
Make Animal an abstract class.
Using the code below:
public class Animal {
//Declaring instance variables
private int age;
private boolean RabiesVaccinationStatus;
private String name;
private String ownerName;
//Zero argumented constructor
public Animal() {
}
//Parameterized constructor
public Animal(int age, boolean rabiesVaccinationStatus, String name,
String ownerName) {
this.age = age;
RabiesVaccinationStatus = rabiesVaccinationStatus;
this.name = name;
this.ownerName = ownerName;
}
// getters and setters
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public boolean isRabiesVaccinationStatus() {
return RabiesVaccinationStatus;
}
public void setRabiesVaccinationStatus(boolean rabiesVaccinationStatus) {
RabiesVaccinationStatus = rabiesVaccinationStatus;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
//toString method is used to display the contents of an object inside it
public String toString() {
return "Age :" + age + ", Rabies Vaccination Status :"
+ RabiesVaccinationStatus + ", Name :" + name
+ ", Owner Name :" + ownerName;
}
}
// Dog.java
class Dog extends Animal {
//Declaring instance variables
private boolean distemperVaccinationStatus;
//Parameterized constructor
public Dog(boolean distemperVaccinationStatus) {
this.distemperVaccinationStatus = distemperVaccinationStatus;
}
//Parameterized constructor
public Dog(int age, boolean rabiesVaccinationStatus, String name,
String ownerName, boolean distemperVaccinationStatus) {
super(age, rabiesVaccinationStatus, name, ownerName);
this.distemperVaccinationStatus = distemperVaccinationStatus;
}
// getters and setters
public boolean isDistemperVaccinationStatus() {
return distemperVaccinationStatus;
}
public void setDistemperVaccinationStatus(boolean distemperVaccinationStatus) {
this.distemperVaccinationStatus = distemperVaccinationStatus;
}
//toString method is used to display the contents of an object inside it
public String toString() {
return "Dog :"+super.toString() + " Distemper Vaccination Status :"
+ distemperVaccinationStatus;
}
public void speak()
{
System.out.println("bark");
}
}
// Cat,.java
class Cat extends Animal {
//Declaring instance variables
private boolean felineLeukemiaVaccinationStatus;
private boolean declawedStatus;
//Parameterized constructor
public Cat(boolean felineLeukemiaVaccinationStatus, boolean declawedStatus) {
this.felineLeukemiaVaccinationStatus = felineLeukemiaVaccinationStatus;
this.declawedStatus = declawedStatus;
}
//Parameterized constructor
public Cat(int age, boolean rabiesVaccinationStatus, String name,
String ownerName, boolean felineLeukemiaVaccinationStatus,
boolean declawedStatus) {
super(age, rabiesVaccinationStatus, name, ownerName);
this.felineLeukemiaVaccinationStatus = felineLeukemiaVaccinationStatus;
this.declawedStatus = declawedStatus;
}
// getters and setters
public boolean isFelineLeukemiaVaccinationStatus() {
return felineLeukemiaVaccinationStatus;
}
public void setFelineLeukemiaVaccinationStatus(
boolean felineLeukemiaVaccinationStatus) {
this.felineLeukemiaVaccinationStatus = felineLeukemiaVaccinationStatus;
}
public boolean isDeclawedStatus() {
return declawedStatus;
}
public void setDeclawedStatus(boolean declawedStatus) {
this.declawedStatus = declawedStatus;
}
//toString method is used to display the contents of an object inside it
public String toString() {
return "Cat :"+super.toString() + " Feline Leukemia Vaccination Status :"
+ felineLeukemiaVaccinationStatus + ", Declawed Status :"
+ declawedStatus;
}
public void speak()
{
System.out.println("Meow");
}
}In: Computer Science
Which clauses in the Software Engineering Code of Ethics are upheld by a whistleblower (check all that apply)
- "Respect confidentiality"
- "Only use property in unauthorized ways"
- "Help create an environment supporting ethical
conduct".
- "Discloses actual/potential dangers".
From the Software Engineering Code of Ethics, which clauses relate to intellectual property (check all that apply)
- "Identify, document, collect evidence and report to the client
or the employer promptly if, in their opinion, a project is likely
to fail, to prove too expensive, to violate intellectual property
law, or otherwise to be problematic."
- "Ensure that there is a fair agreement concerning ownership of
any software, processes, research, writing, or other intellectual
property to which a software engineer has
contributed."
- "Not knowingly use software that is obtained or retained either
illegally or unethically."
- "Disclose to all concerned parties those conflicts of interest
that cannot reasonably be avoided or escaped."
In: Computer Science
What command(s) is/are required to restore a flashed backup of the IOS
In: Computer Science
Add the operation Insert to the linkedListClass. An Insert operation inserts a new item after a given key in the linked list. The method headline can be void Insert(int item, int key), where the first parameter is the new item, and the second parameter is the key of the item before the new item.
In: Computer Science
3. Write a program that will accept only 5 numbers from 50 to 100. The program should remind the user if an inputted number is not on the range. Compute the sum and average of the 1st and the 5th inputted numbers.
In: Computer Science