Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a JAVA solution for For a given list of test cases and results,calculate the total number of points assuming that each group of tests

Write a JAVA solution for For a given list of test cases and results,calculate the total number of points assuming that each group of tests is worth the same number of points. Task Description: Nathan has completed his very first programming test and is now wondering about his score.He received an email containing the final report about the task he solved in the test.but it omitted the score. Nathan never gives up,so he decided to compute his result form the report.He found that: . his program was tested on several test cases; . every test case has given one fo the following results: "OK","Wrong answer","Time limit exceeded" or"Runtime error"; . test cases were organized into groups numbered by consecutive natural numbers. . his program scored points for a group only when the result of every test case in the group was "OK". .In this report,test cases are named according to the following rule: if the test case is the only test case in the group,its name is [task name] + [group number].if there is more than one unit test in the group,its name is extended by lowercase English letter which is different for each test case.Example test case names are test1,test2a,test2b.In this example,test 2a and test 2b form one group and test1 forms another. Nathan's score is the number of groups his program passed multiplied by 100 and divided by the total number of groups.If the result is fractional,the number of points is rounded to the highest integer not greater than the result.for example,if the program passed two groups out of three,the result is 2*100/3 = 66.(6),so Nathan would gain 66 points. Write a function def solution(T,R) that,given the names and results of all the test cases,return the number of points Nathan scored . T and R are arrays (containing strings) of length N.T[i] is a string corresponding to the i-th test case name;R[i] is the result of this test case, containing one of four possible values("OK","Wrong answer","Time limit exceeded" or "Runtime error"). For example,for data: T[0] = "test1a" R[0] = "Wrong answer" T[1] = "test2" R[1] = "OK" T[2] = "test1b" R[2] = "Runtime error" T[3] = "test1c" R[3] = "OK" T[4] = "test3" R[4] = "Time limit exceeded"

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning PostgreSQL On The Cloud Simplifying Database As A Service On Cloud Platforms

Authors: Baji Shaik ,Avinash Vallarapu

1st Edition

1484234464, 978-1484234464

Students also viewed these Databases questions

Question

1. Does your voice project confidence? Authority?

Answered: 1 week ago