LaMarkus Willins

Greenhorn
+ Follow
since Feb 26, 2015
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by LaMarkus Willins

Stefan Evans wrote:Here is one example to demonstrate at least the idea.
I'm going to do it as a JUnit test, but it should at least explain the gist of it.



That explains one simple test case.
What other cases could you test? What happens if you pass an empty array? What about the array [3,2,1]

Edit: @Junilu. Just one example can't hurt can it?



Lol thanks this exactly what I needed thanks, just an example lol.
8 years ago
This is literally all I understand

8 years ago

Paul Clapham wrote:Well, just for example, you might first set an array into an instance of your class. Then you might call the isInIncreasingOrder method on that instance and see if it returns the right value. The "right" value would of course depend on what values were in the array you passed to the instance. So you would try this with an array which is in increasing order, and then with one which isn't in increasing order, and see if isInIncreasingOrder() returns "true" for the first and "false" for the second.

I expect this is already clear to you, but the code you're going to write in the Array class has a purpose and the tests you write are supposed to find out whether the code actually fits that purpose.



lol I'm hopeless this is making no sense to me. Yes I do understand that the Test is going to verify the functionality of the Array class. But I have no idea how to write this in my program.
8 years ago

Campbell Ritchie wrote:You are creating a new instance of your class, then calling its methods in turn. Obviously you will have different methods in your class.
You should override the toString method so you get a decent printout from println. You can read about toString in lots of places; this sample chapter from Joshua Bloch's Effective Java™ is one of them.



How would this work in relation to my code though ? I don't have any numbers so its throwing me off.
8 years ago

Jesper de Jong wrote:If you're not going to use a testing framework like JUnit, then what you have to do is just create a new class named TestArray with a public static void main(String[] args) method.

In there, you can create new instances of your Array class and call methods on it and print out the results, so that you can see if it works as you intended.



Can you show my how I would do this with my program ? Just call one method I could use as an example ?
8 years ago
okay so I have an assignment where I am to create a Array class then create a Driver class (TestArray) to test all the methods in the Array Class. I have no idea how to do this, can you guys help me please ? Here's the code i've written for the Array Class. I just need help developing the TestArray class.

8 years ago
This is what i have so far, pretty sure I'm doing it wrong though.

9 years ago
Can someone lead me in the right direction ? The assignment is due tomorrow night (2/27) at 11:59




Assignments: Students will be required to complete five programming assignments. Students will be given two weeks to complete each assignment. Four of the assignments will count towards the final grade, giving student the option to drop their lowest graded assignment.

Exams: Three exams, including the final exam, will be given. Students will be given at least one weeks notice of the exam dates. All examinations are written examinations and students are required to provide their own College Blue books for each exam. There are no make-up examinations available for any student. If a student has an excused absence exam, the grade he/she receives from the next exam will be counted for both.


Grading plan: Assignments 20%
First exam 15%
Second exam 20%
Lab 20%
Final exam 25%

>= 90 ==> A
>= 80 but < 90 ==> B
>= 70 but < 80 ==> C
>= 60 but < 70 ==> D
< 60 ==> F

Write a java program to help students to calculate his/her grade. The program will prompt user for the following inputs: assignment grades, 2 exam grades, a lab grade, and a grade of the final exam. It then calculates the weighted average and print on the screen both this value and a letter grade the student will receive. Your program should work for as many students as what user needs. The following is the sample screen display where the user inputs are underlined.

Please enter 5 assignment grades: 80 85 65 85 90
After the lowest grade is dropped, your assignment average is 85.0
Please enter 2 exam grades: 70 80
Please enter the lab grade: 100
Please enter the grade of your final exam: 70

The weighted average is:
85.0 * 20% + 70 * 15% + 80 * 20% + 100 * 20% + 70 * 25% = 81.0
You will receive B.

Do you want to calculate for another student? Please type true or false. true
Please enter 5 assignment grades: …
… // screen display for the next student

Do you want to calculate for another student? Please type true or false. false
Bye, bye!

The class that you will be writing will be called LastNameFirstNameCalculateGrades.java.

You are required to use loop and conditional statements. Grading criteria also include good documentation, descriptive variable names, and adherence to the coding convention noted on pages 1 & 2.

Your file will have the following documentation comments before the class header:

/**
@Title: LastNameFirstNameCalculateGrades
@Purpose: To practice java loop and conditional statements.
@Author: (your last first name)
@Date: (today’s date)
@Version: 1.0
*/

Question 2 (40 points): File input and output
Write a program to:
1. Input 10 fractional values from an input file input.txt. (Hint, you have to create the input.txt file yourself) ;
2. Output the sum and the average of the 10 fractional values to an output file output.txt;
Be sure to test to see if you opened the input and output files before you use them.

You are required to use file input and output class. Grading criteria also include good documentation, descriptive variable names, and adherence to the coding convention noted on pages 1 & 2.

Your file will have the following documentation comments before the class header:

/**
@Title: LastNameFirstNameFileInputOutput
@Purpose: To practice java File input and output.
@Author: (your last first name)
@Date: (today’s date)
@Version: 1.0
*/
9 years ago