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

  Definition of constant initialization arrays

You have to extend the definition of constant initialization arrays to multi-dimensional arrays

  Javascript validation - cgi program

CGI mailer script form-mail.pl to your server's cgi-bin directory, and change the permissions on the script to make it executable - BMIS 310

  Develop a java gui application using layout managers

COIT11134Object Oriented Programming - Develop a Java GUI application using layout managers and develop an application that uses two or more classes.

  Create an interface called transcripts

You are going to create an interface called Transcripts with 2 methods: getGPA() and getTotalCredits(). Implement these methods in the Student class you created for Assignment

  Functioning java application.

Your final project must be a complete and functioning Java application.

  Each instance of this class will represent one book a book

each instance of this class will represent one book. a book consists of the title of the book a string and the authors.

  Java program to create a tree

Java program to create a tree, generate class - BottomUpTwoThreeFourTree, BottomUpTwoThreeFourTree,

  Java application to permit user to enter ten numbers

Write down Java application which permits a user to enter 10 numbers (double precision) into the array and then sorts and displays numbers from lowest to highest.

  Create a class for services offered by a hair-styling salon

Create a class for services offered by a hair-styling salon. Data fields include a String to hold the service description and write an application named Salon Report that contains an array to hold six Service objects and fill it with the data

  Calculate your age in the year 2060.

Declare and initialize an integer variable named currentYear. Initialize this variable with the value of the currentYear. Use four digits for year. Use four digits for the year.

  Write a java program using the java graphics

Your task for this assignment is to write a Java program using the Java Graphics class to create an example of a computer generated image. This is an opportunity for you to explore computer graphics and exercise some individual creativity.

  Write code to perform benchmarking of bubble sort algorithm

Write the code to perform the benchmarking of the Bubble Sort algorithm. Your program must include both an iterative and recursive version of the algorithm

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