import java.util.Scanner;

public class Grade
{
public static void main (String[] args)
{
// Declare constants
final double IN_WEIGHT = 0.6; // in-class weight is 60%
final double OUT_WEIGHT = 0.4; // out-of-class weight is 40%

// Declare variables
int preLabPts; //number of points earned on the pre-lab assignment
int preLabMax; //maximum number of points possible for pre-lab
int labPts; //number of poitns earned on the lab
int labMax; //maximum number of points possible for lab
int postLabPts; //number of points earned on the post-lab assignment
int postLabMax; //maximum number of points possible for the post-lab
int outClassAvg; //average on the out of class (pre and post) work
int inClassAvg; //average on the in-class work
double labGrade; //final lab grade

Scanner scan = new Scanner(System.in);

// Get the input
System.out.println("\nWelcome to the Grade Calculator\n");
System.out.print("Enter the number of points you earned on the pre-lab: ");
preLabPts = scan.nextInt();
System.out.print("What was the maximum number of points you could have earned? ");
preLabMax = scan.nextInt();
System.out.print("Enter the number of points you earned on the lab: ");
labPts = scan.nextInt();
System.out.print("What was the maximum number of points for the lab? ");
labMax = scan.nextInt();
System.out.print("Enter the number of points you earned on the post-lab: ");
postLabPts = scan.nextInt();
System.out.print("What was the maximum number of points for the post-lab? ");
postLabMax = scan.nextInt();
System.out.println();

// Calculate the average for the out of class work
outClassAvg = (preLabPts + postLabPts) / (preLabMax + postLabMax) * 100;

// Calculate the average for the in-class work
inClassAvg = labPts / labMax * 100;

// Calculate the weighted average taking 40% of the out-of-class average
// plus 60% of the in-class
labGrade = OUT_WEIGHT * outClassAvg + IN_WEIGHT * inClassAvg;

// Print the results
System.out.println("Your average on out-of-class work is " + outClassAvg + "%");
System.out.println("Your average on in-class work is " + inClassAvg + "%");
System.out.println("Your lab grade is " + labGrade + "%");
System.out.println();
}
}

can anyone help fix this code?

Answers

Answer 1

package Hello;
import java.util.Scanner;

public class NewClass1 {
   
 public static void main (String[] args)
 {
 // Declare constants
 final double IN_WEIGHT = 0.6; // in-class weight is 60%
 final double OUT_WEIGHT = 0.4; // out-of-class weight is 40%

 // Declare variables
 int preLabPts; //number of points earned on the pre-lab assignment
 int preLabMax; //maximum number of points possible for pre-lab
 int labPts; //number of poitns earned on the lab
 int labMax; //maximum number of points possible for lab
 int postLabPts; //number of points earned on the post-lab assignment
 int postLabMax; //maximum number of points possible for the post-lab
 int outClassAvg; //average on the out of class (pre and post) work
 int inClassAvg; //average on the in-class work
 double labGrade; //final lab grade

 Scanner scan = new Scanner(System.in);

 // Get the input
 System.out.println("\nWelcome to the Grade Calculator\n");
 System.out.print("Enter the number of points you earned on the pre-lab: ");
 preLabPts = scan.nextInt();
 System.out.print("What was the maximum number of points you could have earned? ");
 preLabMax = scan.nextInt();
 System.out.print("Enter the number of points you earned on the lab: ");
 labPts = scan.nextInt();
 System.out.print("What was the maximum number of points for the lab? ");
 labMax = scan.nextInt();
 System.out.print("Enter the number of points you earned on the post-lab: ");
 postLabPts = scan.nextInt();
 System.out.print("What was the maximum number of points for the post-lab? ");
 postLabMax = scan.nextInt();
 System.out.println();

 // Calculate the average for the out of class work
 outClassAvg = (preLabPts + postLabPts) / (preLabMax + postLabMax) * 100;

 // Calculate the average for the in-class work
 inClassAvg = labPts / labMax * 100;

 // Calculate the weighted average taking 40% of the out-of-class average
 // plus 60% of the in-class
 labGrade = OUT_WEIGHT * outClassAvg + IN_WEIGHT * inClassAvg;

 // Print the results
 System.out.println("Your average on out-of-class work is " + outClassAvg + "%");
 System.out.println("Your average on in-class work is " + inClassAvg + "%");
 System.out.println("Your lab grade is " + labGrade + "%");
 System.out.println();
 }
 }

 


Related Questions

A uniform resource locator, or url, specifies where you can find a resource on the web; you are probably most used to thinking of them as web addresses. as you move around the web, you see the url of each web page in the address bar of your browser. there are three key parts to the url:

Answers

Protocol, hostname or address, port number, path to file, data to be passed to a CGI program

You use the ____ operator to reverse the meaning of a boolean expression.

Answers

!  actually it means not, which reverses a boolean.

Write the code for invoking a method named sendtwo. there are two arguments for this method: a double and an int. invoke the method with the double value of 15.955 and the int value of 133. assume that sendtwo is defined in the same class that calls it.

Answers

sendtwo( 15.955, 133 );

What is the difference between a static shape and a dynamic shape?

Answers

A static shape has a fixed relationship between all of its vertexes. A dynamic shape can vary the position of at least one of its vertexes in relation to the others.

static shapes are shapes that have no energy, like they are resting. dynamic shapes have energy, like they could be moving.

A directional antenna issues wireless signals along a(n) ____ direction.

Answers

A directional antenna issues wireless signals along a(n) outward direction.

what major criteria must a product or process meet in order to be considered emerging technology?

Answers

A MAJOR criteria that must be met by a product or process is usefulness. IF it isn't useful, why bother experimenting on it?

hope this helps

Under what category of programs and apps do screen savers and backup programs fall?

Answers

The screensaver and backup programs fall under the "Utility" category of programs.
Utility software is framework programming intended to help break down, arrange, enhance or maintain a computer. It is utilized to help the PC  as opposed to application software, which is for specifically performing actions that are of advantage to a normal users.

Only those who perform music professionally can have a true appreciation for music. True False

Answers

False. Anyone can have a true appreciation of music, regardless of whether they play it professionally or not.
Your answer is False because you could have a talent but you don't like it any your just doing it to pay the bills some people do because its what they love but others they have a talent and their parents think to can make some money so your just doing it for the money.

Your answer is False.

A computer connected to the internet that asks for data is a ________. aggregator surrogate server client

Answers

The answer to this question would be client.

Client is the computer that most people use. When you browsing a web using the internet, your computer will ask for data from the web server and the data will be arranged into graphical picture or words what you see on your monitor. Server is the computer that gives data the client ask for.

Two electronics technicians are discussing electrical quantities. Technician A says that resistance is an opposition to electrical power and voltage is electrical pressure. Technician B says that current is the rate of electrical flow in a circuit and voltage is the opposition to current flow. Which of the following statements is correct

Answers

Neither are correct.

Resistance is opposition to CURRENT not power.
Technition B Is wrong about the voltage thingy.

Plz help! 3 questions! 1.The ideal light to use is.... A.front light B.a combination of side and back light C.a combination of front and back light D.side light
2.Incandescent light generally comes from a...A. bulb like one found in a living room B.tube filled with gas C.high voltage LED array D. low voltage LED array.
3.Incandescent light has what type of a color cast? A.greenish B.blue-green C.neutral contrast D. reddish - orange

Answers

There are different kinds and types of light bulb, though light is produce by power, current and resitance.1. The ideal light to use is a front light which it can lighten the dark room depends on the radius of the light or the reflector.

2. Incandescent light generally comes from a bulb like one found in a living room where there are different shapes and lights that have different watts which it differs on how much light it produces or the current and resistance of the light reflector.

3.Incandescent light has a type of a color cast of neutral contrast which also depends on the bulb shapes and kinds. Now we are using LED light to conserve power/energy.

Python comes with ________ functions that have been already prewritten for the programmer.

Answers

Python comes with built-in functions that have been already prewritten for the programmer.

What is a Programming Language?

A programming language refers to a set of instructions that may be used to interact with and operate a computer. Websites, apps, operating systems, spacecraft control, and data analysis are all facilitated by these technologies. Application programs are vital because computers cannot interpret English. Programming languages enable developers to convert their instructions into something that computers can recognize and execute.

As per the question,

Python has built-in functions that have previously been prewritten for the programmer.

Examples of prebuilt functions in Python include math functions for performing mathematical operations, string functions for working with strings, and many others.

Thus, the required fill-in-the-blank would be "built-in".

To learn more about the Python Program click here:

brainly.com/question/15061326

#SPJ5

Not providing guarding or fall protection for workers on a 25-foot scaffold. The resulting fall would most likely end in death, broken bones, and/or other serious injuries. What violation type does this describe?

Answers

Not providing any fall protection on scaffolding would mean be a work hazard and a workplace safety violation und the Occupational and Safety Health Act. The employer would be punishable for this offence. He is required to provide necessary safety measures for his employees.

Suppose that you only have liability and comprehensive car insurance and you allow your roommate (who doesn't have car insurance) to drive your car to run an errand. What will likely happen if there is a single-car accident causing moderate damage to your car while your roommate is driving?

Answers

For an insurance company to pay for a single car accident, one has to have a collision coverage on his or her insurance plan. A liability car insurance plan only covers damage to third party persons and cars while a comprehensive car insurance cater for non collision damages to car. Thus, in the scenario given above, the car insurance company will likely not pay for the damages to the car.

Describe how Iphone 8 can be used to help businesses

Answers

texting and calling your parents

dunnnnnf idajfsiü

Explanation:

You walk by the server room and notice a fire has started. what should you do first?

Answers

I would make sure no one is in the room, and pull the fire alarm. Then I would look for a fire extinguisher and put out some of the fire until the fire department gets there.

I would pull the fire alarm and make sure to evacuate everyone from the server room, look for fire extinguisher.

what is server ?

A server can be defined as a computer device or program which  provides service to client as per the need and type of service, it is a physical computer runs a server program in a center called  data center.

That machine can  be a dedicated server, a model where the client service through server is operated called as  client/server programming model, these program awaits and fulfils requests from client programs that may be running on the same or different computers.

A computer application can be operated as per the request for the service from other programmer, it can also keep the feature or component folders from a website, this can be  hooked up into the web and facilitates the sharing of stored information with certain network linked computers.

For more details regarding server, visit

https://brainly.com/question/7142205

#SPJ2

Which command runs poweroff.target to shutdown the system?

Answers

This is one of the most useful systemD commands : systemctl isolate poweroff.target. For example, if you have a problem with a server and you want to bring the system down so that you could then reseat the card before restarting it, you can use this command, it will shut down the system in an orderly manner.

The definition of an "analog device" is that it is a type of _____.

bitmapping device
translation device
constructive device
deconstructive device

Answers

ITS C hope it helps goo luck!

An analog device is a type of translation device that converts continuous signals into interpretable forms, such as electrical signals from sound waves.

An analog device converts a continuous signal into another form of energy that can be measured and interpreted. For example, a microphone converts sound waves (analog signal) into electrical signals. Similarly, analog meters, such as those with needles moving over a marked gauge, provide a visual reading based on continuous input.
The definition of an analog device is that it is a type of translation device.

How would you delete a slide from your presentation after selecting it?

Choose Delete from the File menu.
Hit the Enter key.
Slides cannot be deleted from presentations.
Use the Backspace key

Answers

choose delete from the file menu.

I think its actually the backspace key

software that instructs the computer how to run applications and controls the display/keyboard is known as the what?

Answers

The software that instructs the computer how to run applications and controls the display /keyboard is known as DRIVERS software, A driver is a software program that enables a specific hardware device to work with a computers operating system. Drivers may be required for internal components such as video cards and optical media drives.

Rules that govern how to communicate online are known as

Answers

they're known as netiquette collectively.

Answer:

netiquette.

Explanation:

edge 2020

Given the string variables name1 and name2, write a fragment of code that assigns the larger of the two to the variable first (assume that all three are already declared and that name1 and name2 have been assigned values).

Answers

Final answer:

The solution involves using an if-else statement to compare two strings and assign the larger value to another variable, with the comparison done lexicographically.

Explanation:

The student is asking for help with a fragment of code in a programming context. The task is to compare two string variables, name1 and name2, and assign the one with the larger value to the variable first. Assuming that the variables are declared and name1 and name2 have values, the code in a language like Python could look like the following:

if name1 > name2:
   first = name1
else:
   first = name2

This code uses a simple if-else statement to compare the strings. In many programming languages, string comparison is done lexicographically (like dictionary order). Hence, 'bigger' string means it comes later in the dictionary, not the length of the string.

The most popular port scanner in the hacking and security community is ________.

a. portscan

b. nmap

c. servport

d. netbios

Answers

The answer is a i had the same question and i got it right

Generally, which website is the most reliable?
A. A.gov site
B. A .com site
C. A wiki site
D. A blog post

Answers

The answer should be A. A gov site. A. com site isn't really reliable because they're usually trying to sell or promote something to you. A wiki site isn't reliable because anyone can add to it incorrectly, same for a blog post.
 A. a gov site gov generally means government.

 

What is the chief ethical concern concerning all the new sources of data available through new technological means like internet research?

Answers

The chief ethical concern is "Privacy". 

A negative aspect of an enormous number of sources available on internet is the concerns about privacy. Web privacy includes the privilege or command of individual protection concerning the sorting, re-purposing, arrangement to outsiders, and showing of data relating to someone through the Internet.Internet security is a subset of data privacy. Privacy concerns have been enunciated from the beginnings of substantial scale PC sharing.

You are given two int variables j and k, an int array zipcodelist that has been declared and initialized, and an boolean variable duplicates. write some code that assigns true to duplicates if any two elements in the array have the same value, and that assigns false to duplicates otherwise. use only j, k, zipcodelist, and duplicates.

Answers

Final answer:

The code uses nested loops to check for duplicates in the integer array, setting the boolean variable 'duplicates' to true if any are found.

Explanation:

To determine if there are duplicates in an integer array, you can use a nested loop structure, iterating through the array with two different variables. Here's a piece of code that does this, using the variables j, k, zipcodelist, and duplicates:

duplicates = false;
for (j = 0; j < zipcodelist.length; j++) {
   for (k = j + 1; k < zipcodelist.length; k++) {
       if (zipcodelist[j] == zipcodelist[k]) {
           duplicates = true;
           break;
       }
   }
   if (duplicates) {
       break;
   }
}

This code initializes duplicates to false. It then uses a nested loop where the variable j is the index for the current element, and the variable k is the index for the following elements to check. If a duplicate is found (when two elements have the same value), duplicates is set to true and the loops are exited using break statements.

Final answer:

To check for duplicates in an array, use nested loops to compare each element with every other element.

Explanation:

One way to check if there are any duplicates in the zipcodelist array is by using nested loops. First, you set the initial value of duplicates to false. Then, iterate over each element in the array using the outer loop with the variable j. Within this loop, use another loop with the variable k to compare each element with every other element in the array. If you find two elements that have the same value, set duplicates to true and break out of the loops.

Here is the code:

boolean duplicates = false;
for (int j = 0; j < zipcodelist.length; j++) {
 for (int k = j + 1; k < zipcodelist.length; k++) {
   if (zipcodelist[j] == zipcodelist[k]) {
     duplicates = true;
     break;
   }
 }
}

This code checks every pair of elements in the array for duplicates, and if it finds any, it sets the duplicates variable to true. If no duplicates are found, the duplicates variable remains false.

What is the benefit of an extranet?

Minimize protection
Provide regulatory control
Reduce security
Supply faster Wi-Fi speed

Answers

provide regulatory control

The benefit of an extranet is that it Provide regulatory control. Check more about extranet below

What is the benefit of extranet?

The Advantages of extranet is that it users to be able to communicate and work together more effectively  especially with their clients, customers, etc.

Note that the benefit of an extranet is that it Provide regulatory control as one can be able to communicate in a secure network.

Learn more about extranet from

https://brainly.com/question/15420829

#SPJ2

You took a fantastic photograph that you want to use in the report you're writing using DTP software. To import the photo into your report, you must first _____.

select Get Image... from the Windows menu
import text
draw an Image Frame
click Save

Answers

Yea I agree its D ALWAYS SAVE

A computer ____ is malicious computer code that reproduces itself on the same computer.
a. worm
b. adware
c. virus
d. spyware

Answers

The answer is virus, because the virus wants to spread quickly and corrupt your computer quickly.

A(n) ____________________ private network is a private and secure network connection between systems that uses the data communication capability of an unsecured and public network.

Answers

A VPN private network is a private and secure network connection between systems that uses the data communication capability of an unsecured and public network.
Other Questions
An equilateral triangle has an apothem measuring 2.16 cm and a perimeter of 22.45 cm.What is the area of the triangle, rounded to the nearest tenth?2.7 cm24.1 cm216.2 cm224.2 cm2 under these rules would the depiction of a cross alone be acceptable How can the rate of a reaction be increased?lowering the temperaturedecreasing the amount of reactantshaving more surface areadiluting a solution How many different types of contraction is skeletal muscle capable of making? Second layer of the cell membrane called BRIANLIEST ~ Part A: Amir rented a scooter at $43 for 3 hours. If he rents the same scooter for 8 hours, he has to pay a total rent of $113.Write an equation in the standard form to represent the total rent (y) that Amir has to pay for renting the scooter for x hours. (4 points)Part B: Write the equation obtained in Part A using function notation. (2 points)Part C: Describe the steps to graph the equation obtained above on the coordinate axes. Mention the labels on the axes and the intervals. (4 points) Which of the following is NOT a type of wellness? Which of the following is NOT a type of wellness? A. spiritual B. social C. spacial D. mental Find the remainder when f(x) is divided by (x - k).f(x) = 4x3 - 5x2 + 2x + 11; k= 3 The sum of two numbers is 35. Three times the larger number is the same as 4 times the smaller number. Find the smaller number (HINT. Let x= larger number; 35- x= smaller number Which phrase is the best definition of symbiosis?A.predation of one species on anotherB.one kind of animal helping anotherC.dormant period of certain organisms during the winterD.two species living in a long-term interrelationship Osmosis involves which of the following processes1) Movement of water up a concentration gradient 2)Movement of water across a cell membrane 3)Movement of solute up a concentration gradient4)Movement of solute across a cell membrane The cerebellum's role in memories may be limited to what kind of learning or memory? Solid aluminum hydroxide reacts with a solution of hydrobromic acid. write a balanced molecular equation and a balanced net ionic equation, including the states of each species. Which of the following statements about the Bill of Rights is NOT accurate?The Bill of Rights includes the first ten amendments to the Constitution.The Bill of Rights specifies things that the government may not do, and rights that the government cannot take away.The Bill of Rights applies only to citizens of the United States.The Bill of rights limits the powers of the federal government. Select answer about motion and newtons law and explain why it's correct 23POINTS NEED ASAP A dog in an open field runs 11.0m east and then 30.0 m in a direction 55.0 west of northIn what direction must the dog run to end up 10.0m south of her original starting point? True or false ? the body uses carbohydrates, fats, and protiens as sources of energy A team of scientists examining the effects of drought conditions on fish populations assembled the data shown. The data are collected from automated stations that monitor water levels in a stream. The scientists suspect that one of the automated stations may be malfunctioning. Based on the data shown, which monitoring station is most likely malfunctioning and reporting erroneous data?Water Depth (cm) at Monitoring Stations June 10th-14thStation IDJune 10June 11June 12June 13Station A44.545.346.447.0Station B43.544.045.246.5Station C42.743.444.545.2Station D33.231.330.732.4 The small amount of dissolved oxygen found in warm water is considered a _______ to the success of many fish species. Sugars are molecules that have __________ c:h:o and are called __________. Steam Workshop Downloader