Question
Exercise 4 Testing your Student ADT (8 pts) You were asked to design an algorithm to put your Student ADT to the test, by calling
Exercise 4 Testing your Student ADT (8 pts) You were asked to design an algorithm to put your Student ADT to the test, by calling each operation at least once in Exercise 2. Convert your pseudo-code from Exercise 2 to Java. To help you, weve provided a guide for the conversion from pseudo-code to Java implementation. Use this as a guide, and not a set of strict instructions. There are too many variations that we cannot account for. 1. Copy your student test design document into a Java file called testStudent.java. Dont change the original! 2. Convert everything in testStudent.java to Java. Work one line at a time, and dont rush. Spend time being sure about syntax. This should take about 30-40 minutes, roughly. 3. You can put your testStudent algorithm in main(). 4. When you think youre done, you can compile it. 5. Correct all the errors! No matter how careful you are, you will always have some. 6. When you have all compiler errors corrected, run your application again. Check the output of your application, and ensure that every operation has the right effect on the Student data.
Here is the Exercise 2 question( no need to be answer)
Design an algorithm to test your Student ADT. Your answer should be in the form of pseudo-code, like main(), in which you call all your ADT operations, and check that they worked. Since this is pseudo-code, you obviously cannot run this application, but a careful design of a test-application can make your development work a lot easier, so you should get in the habit of it. Youll implement your Student ADT later, and a well designed test program will help you determine if your ADT implementation is correct. Time spent thinking about it now will save time later. For this algorithm, the pre-and post conditions are trivial, since this is essentially a main program. Feel free to omit them.
pseudo code:
main() ::
create Student object
objectVariable: studentName=Kevin, firstScore = 90, secondScore =80
// test getter methods and average and object getting created
assert objectVariable.studentName()=='Kevin'
assert objectVariable.firstScore()==90
assert objectVariable.secondScore()==80
assert objectVariable.getAverage()==85
// test setter methods
set objectVariable.setFirstScore() = 100
set objectVariable.setSecondScore() = 0
set objectVariable.setStudentName()= 'Peter'
// test getter methods and average
assert objectVariable.studentName()=='Peter'
assert objectVariable.firstScore()==100
assert objectVariable.secondScore()==0
assert objectVariable.getAverage()==50
_______________________________________________________________________________________________
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started