Write a program that computes a final grade

Assignment Help JAVA Programming
Reference no: EM131125450

Computation

Write a program that computes a final grade, as specified in the course outline using the six term marks: assignments, project, tutorials, quizzes, midterm and final exam.

https://people.scs.carleton.ca/~mjhinek/COMP1406/

The six term marks will be provided to the program via command line arguments (values passed to the program when you run the program from the console window in DrJava) and will always be given in the same order: A, P, T, Q, M, F.

Starting with the skeleton program provided, Grades.java, add code to the computeGrade and roundGrade methods so that the program outputs to standard output (System.out) the correct final grade. Do not change the main method. Your program will output a single line with the computed final grade rounded to exactly one decimal place. The grades provided from the command line can be integers or decimal numbers (all are given as a percentage). To allow for possible bonus marks, valid percentages can range from 0.0 to about 105.0. The roundGrade function will take a double and return a string that represents that number rounded to exactly one decimal place.

Add comments, whitespace, and indentation to the code so that the entire file (Grades.java), not just the functions you are completing, follows the style guide. Marks will be deducted if you do not follow the style guide.

Testing: Create and submit another program called GradesTesting, that tests your Grades program. For each test case, your program should display the input (grades), the expected output of your program and the actual output. For example, a single test case might look like

String[] input = {"75.1", "30", "45.1", "77", "65.2", "72.3"};
System.out.println("Test 0: " + input);
System.out.println(" Expected answer is 65.2");
System.out.print(" Answer obtained is "); ← note the change
Grades.main(input); ← note the change

Your testing program should also follow the style guide. In particular, be sure you describe (in comments) each test case (or group of test cases). The expected and actual output should line up nicely on the screen.

2: Grade Conversion

In the provided Convert.java file, complete the method called convertToLetter. The interface (specification) of the method is given below.

public static String convertToLetter(double grade)
/* Purpose: converts a given numerical grade to a letter grade *
* Input : a number *
* output : the letter grade (F, D-, D, ..., A+) corresponding to the *
* input grade if the input is valid, "Invalid" otherwise */

The conversion table is given as follows

Output

Input Range

A+

[90, 100]

A

[85, 90)

A-

[80, 85)

B+

[77, 80)

B

[73, 77)

B-

[70, 73)

C+

[67, 70)

C

[63, 67)

C-

[60, 63)

D+

[57, 60)

D

[53, 57)

D-

[50, 53)

F

[0, 50)

Invalid

other

Note that the range [a, b) means any number x such that a ≤ x < b. That is, square brackets mean inclusive and parentheses mean exclusive.

3: Longest Streak

In the provided Problem3.java file, complete the method called longestStreak. There should be no other methods or attributes in your class. The contract (specification) of the method is given below.

public static int longestStreak(boolean[] values)
/* Purpose: computes the length of a longest streak of consecutive *
* true occurrences in the input argument values *
* Input : values is a non-null array of booleans with length at least 1 *
* output : outputs the maximal number of consecutive trues found in *
* the input array */

Do not change the method signature (use the provided skeleton java file). Changing the method modifiers, return type, name or input arguments will result in zero correctness marks for this problem.

5: Tic-Tac-Toe

In this problem you will write a program to play tic-tac-toe against a computer. Tic-tac-toe is a game that is played on a 3 × 3 grid. We will label each of the 9 grid elements using the following convention

1

2

3

4

5

6

7

8

9

See https://en.wikipedia.org/wiki/Tic-tac-toe if you are unfamiliar with the game.

Write a program called TicTacToe. You will write this game using concepts of procedural programming (not object oriented programming). Your program should behave as follows:

- Your main method will drive your game by calling other static methods in your class. The overall control flow of your game will be in main but the details of the different actions will be in other static methods.

- Particular tasks should have their own method.

- You will use Scanner objects for user input. You may use String objects. You may use array objects. Your program should not use any other objects.

- Your program will let a user play as many games as they like, until they decide to stop playing. (You must ask the user if they wish to play another game after each game has ended. The expected answers to this question will be yes or no, and be case insensitive).

- Your game must be (relatively) user friendly. That it, it must provide useful prompts to the user during the game. It should say when a game has ended and who won, etc.

- You may assume that all input is valid. When asking for a position to play, the user will always enter a single number between 1 and 9 (inclusive). When asked to play another game, the user will always enter yes or no (or Yes, YEs, yES, nO, NO, etc.).

- Your game must play a valid game of tic-tac-toe. If the user specifies a location is that already taken, an appropriate message must be displayed and the user must be prompted to try again.

- The playing grid should be displayed showing the current state of the game. You should redraw the game after each computer move (so that the user can see what the board looks like).

Reference no: EM131125450

Questions Cloud

Working capital management : •What are the benefits of just-in-time (JIT) techniques?•What types oforganisations use JIT techniques?•Should things change if they are running smoothly?
Determine the due date of the note : Northrop Supply Company received a 30-day, 6% note for $40,000, dated September 23 from a customer on account.
What family will the molecule then belong to : If the H from the OH group in CH3-OH is removed and replaced with a METHYL group, what family will the molecule then belong to?
Describe how you would graph this line : Describe how you would graph this line using the slope-intercept method. Be sure to write in complete sentences. Please help i have more questions and i gotta get my grade up to move on
Write a program that computes a final grade : COMP1006/1406 - Summer 2016 - Write a program that computes a final grade, as specified in the course outline using the six term marks: assignments, project, tutorials, quizzes, midterm and final exam.
Determine the maturity value of the note : Cannondale Supply Company received a 120-day, 9% note for $200,000, dated March 13 from a customer on account.
Common stock with a market value : Global Pistons (GP) has common stock with a market value of $200 million and debt with a value of $100 million. Investors expect a 15% return on the stock and a 6% return on the debt. Assume perfect capital markets.
What do we mean when we say a venture is insolvent : What do we mean when we say a venture is insolvent?
How much would the last grading period be worth : If you made all A's all the way through, how much would the last grading period be worth? Create an equation to represent any grading period along the way

Reviews

Write a Review

JAVA Programming Questions & Answers

  Survey conductor application

Survey Conductor Application: You have been asked by your manager to create a user-friendly application that will present a survey to your customers

  Create a road class

Create a Road class. The class should have functions for setting the width of the road in feet and the length of the road in miles. It should also have functions for obtaining the width of the road the length of the road.

  All your code should be in the main method

Write a Java test program, all your code should be in the main method, that asks the user for two numbers representing an investment value and interest rate

  Organizational report

You have been hired as the CIO of a large multinational Internet advertising company. The president of the company is entertaining a major new software development project to keep track of advertising revenues.

  I had to call a webservice

I had to call a webservice (1st line of code) and then from there created a loop but keep getting an error every time on the .getBusiness - I don't know what I should be using there instead of getBusiness.

  Write following java expressions in mathematical notation

Write the following Java expressions in mathematical notation.

  Java program that can be used to read a list of values

Java program that can be used to read a list of values from the standard input and display the following information based on the values read: 1. All of the positive numbers and the count. 2. All of the negative numbers and the count.

  Digital image processing using java

Digital image processing using java ..create plugin using Jedit and run it in imageJ

  Problem regarding the initializing static fields

Why do static ?elds of a class have to be initialized when the class is loaded? Why can't we initialize static ?elds when the program starts? Give an example of what goes wrong if, instead of static ?elds being initialized too early, they are init..

  Prepare worlddataapp project it implements the nameindex

prepare worlddataapp project. it implements the nameindex portion includingbull creating it implemented as a binary

  Explain the graphical coordinate system in java where is

question 1 describe the graphical coordinate system in java. where is the origin? what units apply to the xy

  Implement the hashcode method

Java, every object has an equals and a hashCode method that is used, among other things, by the standard Collections library. By default both are based on an object's memory location

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd