Please write this in JAVA as well as use the Eq.txt file provided.
intends to auto generate test cases for a function foo that has k integers as input arguments, i.e., foo(int n1, int n2, …, int nk). Each argument belongs to a different equivalence class, which are stored in a downloadable Eq.txt file. The content is shown below and may be modified to handle more inputs and equivalence classes.
For this file, the nth row describes the nth input. Take the second row for example. There are five input arguments. The data 1, 10; 11, 20; 21, 30 indicates that argument n2 has three equivalence classes separated by the semi-colons. Develop an internal method “private int check(int val)” that returns the equivalence class the val is in. The result of check(val = 3) for n2 will be 1 and check(val = 25) for n2 will be 3. Regarding the function foo, it computes the sum of the returned values by the check function for all input arguments.
Follow the contents of the Eq.txt file to automatically create test cases for Strong Normal Equivalence class testing. The input argument values are randomly generated. Store your prepared test cases to a test.txt file. Each test case comes with an expected output at the end. All values are delimited by a comma. In other words, Eq.txt is the input and the test.txt is the output result.
THE Eq.txt FILE IS
1, 15; 16, 30
1, 10; 11, 20; 21, 30
1, 5; 6, 10; 11, 15
1, 3; 4, 6; 7, 9; 10, 12
1, 12; 13, 24
def equivalence:
def __init__(self, v):
self.__check(v)
def __check(self, val):
foo(self, val)
def foo(self, n1):
with open(".\test.txt", 'w') as w:
with open(".\Eq.txt", 'r') as f:
allLine = f.readlines()
sumVal = 0
for line in allLine:
li = line.spilt(';')
countVal = 0
for i in li:
countVal = countVal + 1
rangeVal = li.split(',')
If((int(rangeVal[0].strip())<= n1) and (int(rangeVal[1].strip())>= n1)):
sumVal = sumVal + countVal
break
w.write(str(sumVal))
obj = equivalence (25)
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- JAVA write grading program for a class with the following grading policies. thers a total of 2 quizzes, each graded on the basis of 10 points. theeres is 1 midterm exam and one final exam, each graded on the basis of 100 points. final exam counts for 50% of the grade, the midterm counts for 25%, and the 2 quizzes together count for a total of 25%. (Do not forget to normalize the quiz scores.) letter grade will be given based on the following criterion: 90 – 100 A 80 – 89 B 70 – 79 C 60 – 69 D 0 – 59 E program will read student’s scores from a txf file, save them in an arrayor arrays), process the arrays), print the student’s record, which consists of the name, 2 quiz and 2 exam scores as well along with students avg numscore for the course and final letter rade. please noteAll the scores are integers and a student name consists of no more than 10 characters. justify output filearrow_forwardin c++ solve the following picture :arrow_forwardPlease write a full code in JAVA for this: A function foo has k integers as input arguments, i.e., foo(int n1, int n2, ..., int nk). Each argument may belong to a different equivalence class, which are stored in an Eq.txt file. In the file, the nth row describes the nth input. Take the second row for example. The data 1, 10; 11, 20; 21, 30 indicates that n2 has three equivalence classes separated by the semi-colons. There is an internal method “int check(int n)” that returns the equivalence class n is in. The result of check(n2 = 3) will be 1 and check(n2 = 25) will be 3. Regarding the function foo, it computes the sum of the returned values by the check function for all input arguments.Follow the Eq.txt file to automatically create test cases for Strong Normal Equivalence class testing. The input argument values are randomly generated. Store your prepared test cases to a test.txt file. Each test case comes with an expected output at the end. All values are delimited by a comma.…arrow_forward
- This is in C++ given main(), define the Team class (in files Team.h and Team.cpp). For class member function GetWinPercentage(), the formula is: teamWins / (teamWins + teamLosses) Use casting to prevent integer division. Ex: If the input is: Ravens 13 3 where Ravens is the team's name, 13 is number of team wins, and 3 is the number of team losses, the output is: Congratulations! Team Ravens has a winning average! If the input is Angels 80 82, the output is: Team Angels has a losing average. The template provided is this: #include <iostream>#include <string>#include "Team.h"using namespace std; int main(int argc, const char* argv[]) {string name;int wins;int losses;Team team; cin >> name;cin >> wins;cin >> losses; team.SetTeamName(name);team.SetTeamWins(wins);team.SetTeamLosses(losses); if (team.GetWinPercentage() >= 0.5) {cout << "Congratulations, Team " << team.GetTeamName() <<" has a winning average!" << endl;}else {cout…arrow_forwardI'm just having trouble with some of the components to build of this entire function and want something to compare.arrow_forwardWrite a simple trivia quiz game using c++ Start by creating a Trivia class that contains information about a single trivia question. The class should contain a string for the question, a string for the answer to the question, and an integer representing the dollar amount the question is worth (harder questions should be worth more). Add appropriate constructor and accessor functions. In your main function create either an array or a vector of type Trivia and hard-code at least five trivia questions of your choice. Your program should then ask each question to the player, input the player’s answer, and check if the player’s answer matches the actual answer. If so, award the player the dollar amount for that question. If the player enters the wrong answer your program should display the correct answer. When all questions have been asked display the total amount that the player has won.arrow_forward
- Implement the following functions. Each function deals with null terminated C-Style strings. You can assume that any char array passed into the functions will contain null terminated data. Place all of the functions in a single file and then (in the same file) create a main() function that tests the functions thoroughly. You will lose points if you don't show enough examples to convince me that your function works in all cases. Please note the following: You may not use any variables of type string. This means that you should not #include <string>. Also, you may not use any c-string functions other than strlen(). If you use any other c-string functions, you will not get credit. Note, however, that functions such as toupper(), tolower(), isalpha(), isspace(), and swap() are NOT c-string functions, so you can use them. Also note that this prohibition is only for the functions that you are assigned to write. You can use whatever you want in your main() function that tests the…arrow_forwardYour task is to create a function that simulates a vending machine. Given an amount of money (in cents ¢ to make it simpler) and a product Number, the vending machine should output the correct product name and give back the correct amount of change. The coins used for the change are the following: [500, 200, 100, 50, 20, 10] The return value is an object with 2 properties: • product: the product name that the user selected. change: an array of coins (can be empty, must be sorted in descending order). Examples vendingMachine (products, 200, 7) vending Machine (products, 500, 0) → "Enter a valid product number" vendingMachine (products, 90, 1) "Not enough money for this product" → {product: "Crackers", change: [50, 20, 10arrow_forwardAccording to the given question, we have to create the test-cases based on the above-given function to test all_fluffy function. all_fluffy_v0 is the correct version and all_fluffy_v1 is the buggy versionarrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY