Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

The bolded statement in my code produces the output of 0.0 / 0 if the totalScore / totalMax produce a double. I've been trying different solution for an hour, but nothing seems to work! Any help is appreciated, thank you.

  public static double homework(Scanner console) {

   System.out.println("Please enter information about your homework:");

   System.out.println("Weight? 0-100?");

   int weight = console.nextInt();

   System.out.println("Number of assignments?");

   int assign = console.nextInt();

   int score = 0;

   int max = 0;

   for (int i = 1; i <= assign; i++) {

     System.out.println("Assignment " + i + " score and max?");

     score = score + console.nextInt();

     max = max + console.nextInt();

   }

   System.out.println("How many section did you attend?");

   int attendance = console.nextInt();

   int sectionPointsEarned = attendance * 5;

   if (sectionPointsEarned > sectionPoints) {

     sectionPointsEarned = sectionPoints;

   }

   System.out.println("Section points = " + sectionPointsEarned + "/ " + sectionPoints);

   int totalScore = score + sectionPointsEarned;

   int totalMax = max + sectionPoints;

   if (totalScore > totalMax) {

     totalScore = totalMax;

   }

   System.out.println("Total points = " + totalScore + "/ " + totalMax);

   double weightedScore = ((weight * 1.0) * (totalScore / totalMax));

   weightedScore = Math.round(weightedScore * 10.0) / 10.0;

   System.out.println("Weighted score = " + weightedScore + " / " + weight);

   System.out.println();

   return weightedScore;

  }

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92676967
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Represent the number obtained by the last you have digits

Represent the number obtained by the last you have digits of your student number in binary, e.g., if your student number is XXX8372 then the question is to represent "8372" in binary. Also, represent the first three digi ...

For each of the following situations indicate the

For each of the following situations indicate the appropriate distribution to model the random variable, X. 1. Five cards are selected randomly, with replacement from a deck of 52 cards. Let X= the number of kings select ...

The freemont automobile factory has discovered that the

The Freemont Automobile Factory has discovered that the longer a worker has been on the job, the more parts the worker can produce. I need help finding an application that computes and displays a worker's anticipated out ...

Describe how to discover cookies on web browsers what is a

Describe how to discover cookies on web browsers. what is a reverse DNS lookup and can it be used when attacking the network.

Suppose that we have a block cipher and want to use it as a

Suppose that we have a block cipher and want to use it as a hash function. Let X be a specified constant and let M be a message consisting of a single block, where the block size is the size of the key in the block ciphe ...

You own a specialty company self made company smc which

You own a specialty company; self made company (SMC) which sells hats and jackets. You obtained an object IDENTIFIER 5000 under enterprises node from IANA. You have two branch locations. Each has an inventory system that ...

Meannbsp3290 milesstandard deviation ofnbsp384 mileswhat is

Mean 3290 miles Standard Deviation of 384 miles What is the probability that the mean of a sample of 33 cars would be less than 3160 miles?

Question specify design and implement a class for a card in

Question : Specify, design, and implement a class for a card in a deck of playing cards. The object should contain methods for setting and retrieving the suit and rank of a card. In C++ please

Review the interactive session on pages 50 and 51 in

Review the Interactive Session on pages 50 and 51 in Management Information Systems: Managing the Digital Firm (11th ed.) of your text. It discusses Air Canada. Answer "Case Study Questions" 1 through 3 on page 51. 1. Ho ...

At a certain temperature 0317 mol of ch4 and 0719 mol of

At a certain temperature, 0.317 mol of CH4 and 0.719 mol of H2O is placed in a 4.00 L container. CH4(g)+2H20(g) ---, CO2 (g) +4H2 (g) At equilibrium, 4.80 g of CO2 is present. Calculate Kc.

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As