Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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.

http://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 http://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).

Java, Programming

  • Category:- Java
  • Reference No.:- M91882003
  • Price:- $70

Priced at Now at $70, Verified Solution

Have any Question?


Related Questions in Java

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Assignment - java program using array of objectsobjectives

Assignment - JAVA Program using array of objects Objectives - This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details - For this assignment, you are required to develop a Menu ...

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Object-oriented software development1 introduction 11

OBJECT-ORIENTED SOFTWARE DEVELOPMENT 1. Introduction 1.1 Assignment Requirement 1.2 Deliverables and Structure (what to submit) 1.3 Software Restrictions 1.4 How to score high... 1.5 Assumptions 2. System Requirements 2. ...

  • 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