Please 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.
Eq.txt:
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
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- The file text.txt contains a sentence text written in all small letters and does not have any punctuation marks, no numbers, no symbols except for spaces. You are required to write a program which accepts an operation code, and zero to two inputs depending on the operation code. Based on the operation code, you will call three versions of the overlaoded function textProcessing as follows: ● Operation 0: The function removes all vowels from the ORIGINAL sentence. The vowels considered are the small letters (a, e, i, o, u y, and w). • Operation 1: The code further asks for one lowercase letter to be input by the user. If the character is not a lower case letter, the code outputs Invalid.The function returns the distance (difference) between the letter first occurence and last occurence in the text. If the letter does not occur in the sentence, it returns 0. • Operation 2: The code asks for two lowercase letters to be input by the user. If the characters are not lower case letters, the…arrow_forwardAdd a function to get the CPI values from the user and validate that they are greater than 0. 1. Declare and implement a void function called getCPIValues that takes two float reference parameters for the old_cpi and new_cpi. 2. Move the code that reads in the old_cpi and new_cpi into this function. 3. Add a do-while loop that validates the input, making sure that the old_cpi and new_cpi are valid values. + if there is an input error, print "Error: CPI values must be greater than 0." and try to get data again. 4. Replace the code that was moved with a call to this new function. - Add an array to accumulate the computed inflation rates 1. Declare a constant called MAX_RATES and set it to 20. 2. Declare an array of double values having size MAX_RATES that will be used to accumulate the computed inflation rates. 3. Add code to main that inserts the computed inflation rate into the next position in the array. 4. Be careful to make sure the program does not overflow the array. - Add a…arrow_forwardCreate a new file in C++ and save it as lab12_XYZ.cpp Consider rolling two six-sided dice. While the result of each throw is independent of all rolls that have come before, we can still calculate the odds of rolling any given number between 2 and 12. This program will calculate those odds by generating a large number (100,000) of random values (i.e. "rolling the dice") and storing the results in an array. When all values have been rolled, we will display the results (counts and odds to 2 decimal places) to the user. x x 2 3 4 5 6 7 8 9 10 11 12 //value for sum of 2 dice rolls +---+---+---+---+---+---+---+---+---+---+--- | | | | | | | | | | | | | | //counters for number of times value is rolled +---+---+---+---+---+---+---+---+---+---+---+---+---+ 0 1 2 3 4 5 6 7 8 9 10 11 12 //array index In Lab 5, sample code was provided for generating a random number. In this lab, I've provided a header file…arrow_forward
- in C++ pleasearrow_forwardIn C++ write a program that takes user input from consoles for integers. Enter a negative value to end input. Use vectors and calculate a histogram of the values entered. Use bins of size ten and output the histogram as bins and the number of values that fall in each bin.arrow_forwardPlease use Python for this question. Please format code properly when answering the question. Write a standalone function partyVolume() that takes accepts one argument, a string containing the name of a file. The objective of the function is to determine the Volume object that is the result of many people at a party turning the Volume up and down. More specifically: the first line of the file is a number that indicates the initial value of a Volume The remaining lines consist of a single character followed by a space followed by a number. The character will be one of ‘U” or ‘D’ which stand for “up” and “down” respectively. The function will create a new Volume object and then process each line of the file by calling the appropriate method of the Volume object which changes the value of the Volume. The function then returns the final Volume object. Guidelines/hints: This is a standalone function, it should NOT be inside (indented within) the class. It should be listed in…arrow_forward
- Write a C program that reads an unspecified number of integers from a file called nums.txt ( up to a maximum of 100 numbers ) and stores those numbers in an array. Your program should then print to the screen the number with the maximum sum of divisors as well as its position in the array in main. Your program should include and use the following two functions: 1. function sum_of_divs which takes any integer and returns the sum of its divisors ( e.g. for the number 20 the function should return the value 42 which is 1+2+4+5+10+20). 2. function max_sum_and_pos which takes the array of integers as input and returns both the number (not the sum) with the maximum sum of divisors as well as its position in the array. Example of a Sample Run : Assume that the file nums.txt has the following 6 numbers ( nums.txt can have up to a 100 numbers which means your array size should be defined as 100): 53 61 40 83 49 44 your program should print the following to the screen: The number with max sum of…arrow_forwardWrite a function IN C LANGUAGE that splits the following data read from a file named info.txt and store the data into a struct as show in the example: typedef struct{char name[20];char gender[5];char dateOfAdmission[20];char dateOfBirth [20];char illness [20];char address [20];char bloodType[5]; } information; Abed Mukhles#M#2212019#01012000#Ear Infection#Jenin#O+ Here the values are: name:Abed Mukhles gender:M dateOfAdmission:2212019dateOfBirth:01012000illness:Ear Infectionaddress:JeninbloodType:O+ Same for:Nadia A. Ali#F#01102020#05101970#COVID-19#AlBireh#A-arrow_forwardAdd file i/o to your program Implement a function writeEmpToFile that takes two arguments: a struct Employee pointer and a FILE *. It should write each field in order as an appropriate type. Note that you will probably want to write a length of the name before you write the characters of the name. By doing this, when you write the load function below, you can read the length of the string and use it to malloc a buffer of the proper size to hold the name. Because of the embedded name pointer, you CAN NOT write the Employee struct as a single struct. You will need to write it out field by field. You will want to write this as a binary file, not as a text file. Implement a SAVE command in your main loop that will save all the employees out to a file. The SAVE command should ask for a file name, similar to the way your FIND command asked for a name. Implement a function readEmpFromFile that takes a FILE * as the only argument and returns a pointer to a struct employee. This function should…arrow_forward
- The programming language is - Python a. Write a function called daysOver that takes three arguments: a dictionary, a location (such as ‘Sydney’, ‘Adelaide’,etc) and a temperature and returns the number of days that were over the given temperature for the given location. For example, if we call the function using the line: total = daysOver(dictionaryData, ‘Adelaide’, 40) total will hold the number of days that Adelaide had a temperature greater than 40 celsius in the data. As a test, there were 54 days over 40 celsius in the data. Check that total is 54 for the example when you run your code. b. Use the daysOver function to print the number of days over 35 celsius for each of the following cities: 'Adelaide','Perth','Melbourne','Canberra','Sydney','Brisbane','Darwin' c. Which of the Australian cities has the most number of days over 35 celsius? My spreadsheet looks like this Since I cannot attach an excel file, my excel file name is "weatherAUS.csv"arrow_forwardHow to write C++ program that contains two arrays called actors and roles, each of size N. For each i, actors[i] is the name of an actor and roles[i] is a multiset of strings that contains the names of the movies that the actor has appeared in. The program reads the initial information for these arrays from files in a format that you design. Once the program is running, the user can type in the name of an actor and receive a list of all the movies for that actor. Or the user may type the name of a movie and receive a list of all the actors in that movie ?arrow_forwardImagine that you are a biomedical engineer analyzing DNA sequences. You have numerical measurements from two different measurement sources, m1 and m2, both of which are arrays. Write a function named dna that takes these two arrays as inputs. It should return a character array string of nucleotides (represented by the letters A, C, G and T). For a given index, i, the nucleotide in the string is: - ‘A’ if m1(i) >= 0 and m2(i) >= 0 - ‘C’ if m1(i) < 0 and m2(i) >= 0 - ‘G’ if m1(i) >= 0 and m2(i) < 0 - ‘T’ if m1(i) < 0 and m2(i) < 0 code to call the function m1 = [-2 -3 2.5 0.3]; m2 = [1.1 2.1 -0.8 0.1]; sequecne = dna(m1,m2); function dna Please use MATLABarrow_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