Q.1.5 Consider the following snippet of code being tested: 1. Print “Please enter your age: “ 2. Read age 3. IF age >= 60 4. Print “Qualify for pensioner’s discount” 5. ELSE 6. Print “Do not qualify for pensioner’s discount” 7. ENDIF Assume you apply the following test case to the code snippet above: Test Case 1 : age = 93 Q.1.5.1 Calculate the statement coverage achieved for Test Case 1 and provide a brief explanation for your response. (3) Q.1.5.2 Calculate the decision coverage achieved for Test Case 1 and provide a brief explanation for your response
Q: Write declarations to declare each variable to have the specified type and initial value: Problem:…
A: Variable declaration: A variable is a name that is the name given to a memory location in computer…
Q: Jane wants to become a doctor. If Jane obtains an average of 90% for Maths in her final exams, she…
A: Required: Jane wants to become a doctor. If Jane obtains an average of 90% forMaths in her final…
Q: .3.2: Basic class use. Print person1's kids, call the incNumKids() method, and print again,…
A: Java The JavaTM Programming Language is an object-oriented, concurrent, deeply typed,…
Q: 3. A safe is locked by a combination of of four binary digits (that is, 0 or 1), but the owner has…
A: Answer 3. a)
Q: Jane wants to become a doctor. If Jane obtains an average of 90% for Maths in her final exams, she…
A: 1. Input average marks for Maths to Mathmarks 2. Input the average marks for Overall subject to Avg…
Q: The average of a set of values can be calculated by the following equation. Write the proper code…
A: Note: This code should be rewritten instead of copying to the compiler otherwise it will throw a…
Q: State whether true or false. The following code will throw an error: double a = 2; double b = 3;…
A: Since the programming language is not mentioned, I have verified the code using C++.
Q: An electronic shop wants you to write a program to take orders from the clients and print the…
A: function main: Start read item read price read quantity read delivery type if delivery is fast then…
Q: Project description The problem here is to make change using the smallest number of American coins.…
A: Code: #include<stdio.h>#include<stdlib.h>int *change(int amount){ int *data =…
Q: CHALLENGE 1.2.3: Read multiple user inputs. ACTIVITY Write two cin statements to get input values…
A: #include <iostream> using namespace std; int main(){ int birthMonth; int birthYear;…
Q: [python language] Write a program that takes a single user input then outputs the type of data…
A: HI THEREI AM ADDING ANSWER BELOWPLEASE GO THROUGH ITTHANK YOU
Q: Write the output of the code given below? for ( int x=1; x <= 10; x++ );…
A: The solution is the output of the problem. NOTE: The output given below can only be produced only…
Q: What is the output of the following code: int main() { test1(); test1(); return 0; } void…
A: Given: What does the following code produce:
Q: Mad Libs are activities that have a person provide various words, which are then used to complete a…
A: #Code: import java.util.Scanner; public class LabProgram { public static void main(String[]…
Q: 4. Write a program that simulates the rolling of two dice. The program should use rand twice to roll…
A: Code: #include <stdio.h>#include <stdlib.h>#include <time.h> int main(){ int…
Q: 3. A safe is locked by a combination of of four binary digits (that is, 0 or 1), but the owner has…
A: Answer (a).
Q: If you are flying with an economy ticket, there is a possibility that you may get upgraded to…
A: Decision table is a method of describing the logical relationship as a visual representation ( in…
Q: You can get a booster dose of a vaccine 152 days after your second dose. Write ac program that reads…
A: /*#include <stdio.h>#include <string.h>#include <stdlib.h>#include <time.h>…
Q: 14. Suppose that score is an int variable. Consider the following if statements: if (score >- 90) ;…
A: The given if statementif (score >= 90) System.out.println("Discount= 10%" ); As per the…
Q: Read the following short scenario, then answer the questions that follow: Jane wants to become a…
A: start declarations int avg,math,bio,phy,lang,bsc set…
Q: Write a set of test cases – specific sets of data – to properly test a simple program ¡ Program…
A: Code: The triangle function accepts three integer parameters, which represent the lengths of the…
Q: 1. Assume x is an int which has been declared and assigned a valid value. x guaranteed to change…
A: The given code is used the multiple if statement, in which control is evaluate both if statement…
Q: Read the following short scenario, then answer the question that follows: Jane wants to become a…
A:
Q: 1. Using an if/else construct, write a program that will calculate a person's pay based on the…
A: As you have not specified programming language i have wrote it in c language. Algorithm: 1.Declare…
Q: Write a program that simulates flipping a coin to make decisions. The input is how many decisions…
A: For the given question, we have to design a Python program that does/includes the following :…
Q: Write multiple if statements: If carYear is before 1967, print "Probably has few safety features."…
A: According to the information given:- We have to follow the instruction mentioned in order to get…
Q: 3. A safe is locked by a combination of of four binary digits (that is, 0 or 1), but the owner has…
A: Answer is below:
Q: = int(input("Enter value for x:")) if x == -1 : print("Disagree") elif x == 0: print("Neutral")…
A: Please find the answer below
Q: 2.34 LAB: Input: Mad Lib Mad Libs are activities that have a person provide various words, which…
A: Answer :-
Q: 6.30 LAB: Flip a coin Write a program that simulates flipping a coin to make decisions. The input is…
A: NOTE - This is a Java question, so I have written the code in the Java programming language. Here I…
Q: If you are flying with an economy ticket, there is a possibility that you may get upgraded to…
A: A decision table is a graphic representation that describes the logical link ( in understandable…
Q: Declare fvar number :=null; svar number :=5; Begin goto > if fvar is null then >…
A: Declare fvar number :=null;//fvar=null svar number :=5;//svar=5 Begin goto…
Q: Question #1: Treadmill burned calories Java Program A treadmill workout machine provides the…
A: // Screenshot of the code & output // code to copy CaloriesBurned.java import java.util.Scanner;…
Q: ation error. 2. Determine the output if that statement is removed. class A { public void test() {…
A: The statement that causes the compilation error. Determine the output if that statement is…
Q: 3. Write a program that checks the screen time of a child and repeats, this procedure three times.…
A: #include<stdio.h>int main(){ int age; float screen_time; for(int i=0;i<3;i++){…
Q: there are three seating categories at a stadium. for a softball game, class A seats are $30, Class B…
A: Since no programming language is mentioned, I am using python. Code: print("Enter number of tickets…
Q: ball is red. q: The second ball is white. r: The third ball is blue. Which would be the…
A: Given the Value p: The first ball is red. q: The second ball is white. r: The third ball is…
Q: 1. Write the java statement that assigns 1 to x if y is greater than 0 2. Suppose that score is a…
A: As you have asked multiple question we are answering first. If you want solution of any specific…
Q: 2-Fully explain the following code and draw all possible outputs. Please input a number between 5…
A: Given code: <!DOCTYPE html> <html> <body> <p>Please input a…
Q: 8. Write a program that calculates and displays a person's body mass index (BMI). The BMI is often…
A: Input weight, height Calculate BMI Use if conditional statements to check the person condition based…
Q: Dry run the below programs and explain the reasons of output. If there is any error then correct…
A: Output: 20 10
Q: 1. Using an itjelse construct, write a program that will calculate a person's pay based on the…
A: Algorithm:1.import util package for scanner class 2.define a class named WorkPay2 3.In the main…
Q: 1. Write a program to play rock-paper-scissors. The program should let the user determine whether it…
A: from random import randint #create a list of play optionst = ["Rock", "Paper", "Scissors"] #assign a…
Q: Q3/A- Estimate the result when you execute the following code by using Qbasic programming For m take…
A: Here is the result:
Q: : write a program with visual basic code to give the evaluation for different marks as follows.…
A: below is the code:
Q: Q2) write a java code to calculate the average for 3 student (each student has 5 subjects) and…
A: The marks for the students are in the range 0 to 50, with 50 being the highest marks. The Java…
Q: Computer Science Please use PYTHON (if/when necessary) to answer the following. Thank you. The…
A: class py_solution: def pow(self, x, n): if x==0 or x==1 or n==1: return x…
Q: By using loop and random method write java program to generate and print 10 integer numbers (“range…
A: Given: By using loop and random method write java program to generate and print 10 integer numbers…
Q: 20.5 LAB: Flip a coin Write a program that simulates flipping a coin to make decisions. The input…
A: PROGRAM CODE: # import the required modulesimport random# start the definition of the function to…
Q.1.5 Consider the following snippet of code being tested:
1. Print “Please enter your age: “
2. Read age
3. IF age >= 60
4. Print “Qualify for pensioner’s discount”
5. ELSE
6. Print “Do not qualify for pensioner’s discount”
7. ENDIF
Assume you apply the following test case to the code snippet above:
Test Case 1 : age = 93
Q.1.5.1 Calculate the statement coverage achieved for Test Case 1 and provide
a brief explanation for your response.
(3)
Q.1.5.2 Calculate the decision coverage achieved for Test Case 1 and provide a
brief explanation for your response
Step by step
Solved in 2 steps with 1 images
- The questions should be completed with OCaml. Running screenshots should be provided. The background information is given by the picture. Question 1: Provide 5 good test cases each for eval_success_tests and eval_failure_tests, following the format of: let eval_success_tests : ((truth_assignment * formula) * bool) list = [] let eval_failure_tests : ((truth_assignment * formula) * exn) list = [] Question 2: Implement the function eval : truth_assignment -> formula -> bool. let eval (state : truth_assignment) (formula : formula) : bool = raise Not_implemented You are evaluating boolean formulae instead of float arithmetic. You also need to use the correct boolean value for each variable. We recommend using Variable_map.find_opt to perform lookups in the truth assignment. If a variable is needed but does not appear in the truth assignment, you must raise an Unassigned_variable x exception, where x is the unassigned variable. Once again, you may use any functions you want and…Consider the following class declaration and variable definitions, then answer the following questions. #include <stdio.h> class A { private: class B { public: B() { x = 1; } int x; int& getx() { return x; } void print() { printf(“%d”,x); } }; private: B b; public: class C { private: int w; public: C() { w = 5; } B b; int &getw() { return w; } void print() { b.print(); printf(“%d”,w); } }; C c; void print() { b.print(); c.print(); } int& getx() { return b.getx(); } }; Assume each code snippet in each row below runs independently in a main function. For each one, say whether it's legal code or not. If it is, show the output and explain why it happens. If it’s illegal (e.g. syntax error), explain why. Try to do it without running the code, and then check and correct your answers as needed. # Code snippet Errors? (Yes or No) Output or explanation of error. 1…When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making periodic payments over a certain period of time. Of course, the lending company will charge interest on the loan. Every periodic payment consists of the interest on the loan and the payment toward the principal amount. To be specific, suppose that you borrow $1,000 at an interest rate of 7.2% per year and the payments are monthly. Suppose that your monthly payment is $25. Now, the interest is 7.2% per year and the payments are monthly, so the interest rate per month is 7.2/12 = 0.6%. The first months interest on $1,000 is 1000 0.006 = 6. Because the payment is $25 and the interest for the first month is $6, the payment toward the principal amount is 25 6 = 19. This means after making the first payment, the loan amount is 1,000 19 = 981. For the second payment, the interest is calculated on $981. So the interest for the second month is 981 0.006 = 5.886, that is, approximately $5.89. This implies that the payment toward the principal is 25 5.89 = 19.11 and the remaining balance after the second payment is 981 19.11 = 961.89. This process is repeated until the loan is paid. Write a program that accepts as input the loan amount, the interest rate per year, and the monthly payment. (Enter the interest rate as a percentage. For example, if the interest rate is 7.2% per year, then enter 7.2.) The program then outputs the number of months it would take to repay the loan. (Note that if the monthly payment is less than the first months interest, then after each payment, the loan amount will increase. In this case, the program must warn the borrower that the monthly payment is too low, and with this monthly payment, the loan amount could not be repaid.)
- Python code for: The set of rules determining the fate of a cell: X is currently dead: If X has exactly three living neighbors, X becomes alive. In all other cases, X remains dead. X is currently alive: If X has zero or one living neighbor (s), X dies of loneliness. If X has two or three living neighbors, X remains alive. In all other cases, X dies of a shortage of living space. The class LifeGeneration represents one generation in a game of life. In the class LifeGeneration, do the following: Make an initializer method that accepts the state of the board as a 2-dimensional list of booleans (indicating if the cell is alive or not) Make the methods width() and height() that give the size of the board. Make a method is_alive(x,y) that returns if the cell at position x, y is alive. Make a method next_generation() that gives the next generation. Make a method is_all_dead() that returns if the generation is dead. Make a method board() that returns a 2-dimensional list of True,…Question #1: Treadmill burned calories Java ProgramA treadmill workout machine provides the following activities: running, walking, and mountainclimbers. The machine uses metabolic equivalents (MET) to measure the amount of energy thatis expended during exercise.Here are the machine different activities and their METS:Running 6 MPH: 10 METSWalking 3 MPH: 4 METSMountain Climbers 3 MPH: 8 METSThe number of calories burned per minute may be estimated using the formula:Energy expenditure (Calories/ Minute) = 0.0175 × MET × Weight (in kilograms).In this question, ywrite a Java program, which:1. Display a welcome message.2. Prompts the user to enter the weight in pounds.3. Prompts the user to enter the running, walking and mountain climbers’ timesrespectively.4. calculates and outputs the calories burned for each activity as well as the total number ofcalories burned.5. Display a farewell message, so that the user knows that the program has terminatednormally, example: Keep up your hard…Question #1: Treadmill burned calories Java ProgramA treadmill workout machine provides the following activities: running, walking, and mountainclimbers. The machine uses metabolic equivalents (MET) to measure the amount of energy thatis expended during exercise.Here are the machine different activities and their METS:Running 6 MPH: 10 METSWalking 3 MPH: 4 METSMountain Climbers 3 MPH: 8 METSThe number of calories burned per minute may be estimated using the formula:Energy expenditure (Calories/ Minute) = 0.0175 × MET × Weight (in kilograms).In this question, write a Java program correctly, which:1. Display a welcome message.2. Prompts the user to enter the weight in pounds.3. Prompts the user to enter the running, walking and mountain climbers’ timesrespectively.4. calculates and outputs the calories burned for each activity as well as the total number ofcalories burned.5. Display a farewell message, so that the user knows that the program has terminatednormally, example: Keep up your…
- Let Q(x, y) denote the statement “x has sent an e-mail message to y”, where the domain for both x and y consists of all students in your class. Express each of the following quantifications in English. 1. x y Q(x, y) 2. x y Q(x, y) 3. x y Q(x, y) 4. y x Q(x, y) 5. y x Q(x, y)def new_line(): print('.') def three_lines(): new_line() new_line() new_line() def nine_lines(): three_lines() three_lines() three_lines() def clearScreen(): print('Printing nine lines') nine_lines() print('Printing nine lines') nine_lines() print('Printing three lines') three_lines() print('Printing three lines') three_lines() print('Printing new line') new_line() print('Line from main function')print('Calling clearScreen function') clearScreen() Assessment The following items will be used in the grading rubric for this assignment. Make sure that you have addressed each item in your assignment. Does the assignment implement new_line, three_lines, nine_lines, and clear_screen functions, as well as a main section of the program which calls the functions? Does the assignment demonstrate the use of nested function calls? Does the assignment produce the appropriate output when executed? The output should be recorded in a text file, a…Assume that you are applying “testing” and “inspection”, the two defect finding methods in the following buggy code example to find defects. Explain how “testing” and “inspection” differ in finding defects quickly and the efforts required for the example. public class Employee { private String id; private int name; private double salary; public Employee(String id,int name,double salary) { } public Employee() { } } Public class Customer { public static void main(String s[]) { Employee e1=new Employee(“10060OTU”, “S1”, 2000.50); Employee e2=new Employee(); System.out.println (“The salary of Employee S1 is”+ e1.salary); }
- Please Help Solve, Thank You! 3.25.2: Basic if-else. Write an if-else statement for the following: If userTickets is not equal to 6, execute awardPoints = 10. Else, execute awardPoints = userTickets. Ex: If userTickets is 14, then awardPoints = 10. import java.util.Scanner; public class TicketCounter { public static void main (String [] args) { int awardPoints; int userTickets; Scanner scnr = new Scanner(System.in); userTickets = scnr.nextInt(); // Program will be tested with values: 5, 6, 7, 8. /* Your code goes here */ System.out.println(awardPoints); }}Description: In a hypothetical class, students take two midterms and an optional final. If a student takes the final and gets in it a better score than the lowest of the two midterm scores, then the lowest midterm score would be replaced by the comprehensive final score. The overall score will then be calculated by averaging the three test scores. If the student does not take the optional final, the overall score is calculated using only the two midterm scores. Students’ exam scores are included in the “Question1” tab in the attached worksheet. Empty data entries for the optional comprehensive final means that the student did not take the optional final. Tasks: Task 1: In Question1_Module, code a function that requires midterm1 score, midterm2 score, and comprehensive final as inputs and calculate the overall score per the description above. Task 2: In Question1_Module, code a Sub that uses the function coded in task 1 to fill column ‘I’ of the worksheet and link this…Description: In a hypothetical class, students take two midterms and an optional final. If a student takes the final and gets in it a better score than the lowest of the two midterm scores, then the lowest midterm score would be replaced by the comprehensive final score. The overall score will then be calculated by averaging the three test scores. If the student does not take the optional final, the overall score is calculated using only the two midterm scores. Students' exam scores are included in the "Question1" tab in the attached worksheet. Empty data entries for the optional comprehensive final means that the student did not take the optional final. Tasks: Task 1: In Question1 _Module, code a function that requires midterm1 score, midterm2 score, and comprehensive final as inputs and calculate the overall score per the description above. Task 2: In Question1_Module, code a Sub that uses the function coded in task 1 to fill column 'I' of the worksheet and link this sub to the…