2. Let x be the first three digits of your matric number, AND y be the last three digits of your matric number. If the first digit of y is 0, replace it with 2. Example: If you matric number is 2013034, Thus, x = 201 and y 234 a. Write the values of x and y based on your matric number. b. If a = x (mod 7) and b = (-1) • y (mod 7), find the integer(s) c with 10 < c < 20 such that c = a + b² (mod 7) c. Show all the steps to calculate LCM (x, y) using prime factorization.
Q: 04 what is the result of following if: a=3, b=3? i- ab iv- a>=b V- a==b vi- a!=b
A: Implementing the above statements through C++ langauge. #include <iostream>using namespace…
Q: Write the inverse of the following statement: “If it is winter, then it is snowing.”
A: As given, we need to write the inverse of the given statement. The given statement - "If it is…
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: Consider the following regular expression r: b(a+ ab) ab Which of the following words are in the…
A: Among the given options, only the following words are matched with the given regular expression r:…
Q: person is trading his money in the stock exchange market. Assume that the daily price of a specific…
A: Solution:
Q: Given the following: Group A (Tom 40, Dave 67) Group B (Jade 30, Molly 25) Group C (Max 50, Comfort…
A: Algorithm : Step 1 : declare variables. Step 2 : assign the marks of each student in each variable.…
Q: iii. Consider the expression T|F^ T. In how many ways can the expression be parenthesized so that…
A: Question iii. Consider the expression T | F ∧ T. In how many ways can the expression be…
Q: From the function x > 0 and y > 0) x + y x + y x2 0 and y < 0 x² + y x<0 and y 2 0 x² + y? x< 0 and…
A: Algorithm : Step 1 : ask for the value of x from user. Step 2 : ask for the value of y from user.…
Q: Let p = “Sophie has been arrested” and q = “Bubba’s never been arrested.” Write the symbolic form of…
A: The Correct solution is C i.e. ~(~p)
Q: Let t0 be a specific value of t. Find t0 such that the statement is true: P(t ≥ t0) = 0.005 where df…
A: Dear Student, To find it's answer we need to refer to t-table . Here given that, P(t ≥ t0) = alpha =…
Q: ow to attempt? Ruestion: he Card Game One day, Fred and his N friends were playing a card game in…
A: ALGORITHM: Include the required header files. Start the definition of the function to find the…
Q: Consider the Prolog gcd program in Figure 1.2. Does this program work “backward” as well as forward?…
A: Solution Dear... The Prolog definition of gcd makes use of GCD's recursive definition, which are:…
Q: 4- Given the following table for letter grades and their corresponding remarks, write a JavaScript…
A: Given: Java script code for Grade: GRADE OUTPUT A You are excellent B You are good C You…
Q: programming for business field in python write a program to find the depreciation value of an…
A: Given, Amount/Price of the asset Year of service Depreciation Rate Depreciated/New Reduced Amount…
Q: Write a function that takes 3 integers (num,den,power) as parameters which represent the rational…
A: - We need to highlight the code for the required scenario of power of rational numbers. - We are…
Q: Given that A and B are real variables with values 1.5, and 2.5 respectively, and C is integer…
A: The given expression is following: NOT(A<0) AND (B/C<=0) The answer is FALSE or 0.
Q: The game of Pig is a simple two-player dice game in which the first player to reach 100 or more…
A: This is required code to perform above problem statement. See below step for code and output:
Q: 17. Consider the following "C" code segment. At least how many test cases are needed for achieving…
A: Each branch of every possible decision point has to be executed at least once. So let's find the…
Q: (Algebra: solve 2 X 2 linear equations) You can use Cramer's rule to solve the following 2 x 2…
A: // Cramer.java /* * This Program will calculate x and y for two linear equations using Cramers rule…
Q: Define function print_popcorn_time() with parameter bag_ounces. If bag_ounces is less than 3, print…
A: Herecour task is to write a python program for the task mentioned in the question. Let's prepare the…
Q: Function power of type real - int - real that raises a real number to an integer power. For example…
A: Function power of type real * int - real......
Q: In c++ A driver needs help finding the shortest path travelling between a number of points. There…
A: Below is the code: apply krushkal algo on graph of each point to each point
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: C++ code A simple version of snakes and ladder Implement a game that initially asks how many…
A: code snippet:
Q: Mutiple Answers Which of the following matches regexp /(very )+(fat )?(tall|ugly) man/ a) very fat…
A: EXPLANATION: The first element of the statement is (very)+ which means that: Very keyword can…
Q: Let P be “this book is a non-fiction book” and Q be “the ideas in the book is consistent with…
A: q: Consider a case where both P and Q are false (e.g. a fantasy novel and an unrealistic phenomenon…
Q: Write the definition of the function add, which takes two integer parameters and returns the sum of…
A: Introduction: Here we are required to write the definition of the function add, which takes two…
Q: This assignment deals with processing the monthly transactions of the clients of a bank. For each…
A: The answer for the above given program is given below:
Q: f b is a unit modulo m and a is another unit with a=b^d (mod m), we say that d is the _________ of a…
A: As given:- According to the question:- a= b( mod n) and we need to write some point for d show we…
Q: Consider the following statements: T(x, y): "x eats y". A(x). "x is wise". S(x): "x is hungry".…
A: option 3
Q: n an ancient land, the beautiful princess Eve (or handsome prince Val) had many suitors. Being…
A: Step 1: Prompt and accept the number of suitors, n. Step 2: Iterate n times and add the suitors to…
Q: Consider the following statements: T(x, y): "x eats y". A(x): "x is wise". S(x): "x is hungry".…
A: Answer: C
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: 2.) Given the following argument: a) If you get an A in finite math, then you will pass finite math.…
A:
Q: Assume int[][] x = {{1, 2}, {3, 4}, {5, 6}}, what are x.length are x[0].length? 5 3 and 2 4 2…
A: EXPLANATION: In the above statement, the x is the multi-dimensional array. In the multi-dimensional…
Q: 1 þef ticket_price(age: int) -> float: "*"Return the ticket price for a person with age in years.…
A: Here I have created a function named ticket_price(). In this function, I have used the if statement…
Q: Write a program function (in any programming language) that will find and add 3 digits odd numbers…
A: A cyclomatic complexity is the measurement that is being correlated to a number of coding errors.…
Q: Java Program create a prog that will compute the final grade for a certain student and will display…
A: PROGRAM EXPLANATION: Import java.util package. Create the main class. Create the main method.…
Q: This is a JAVA programming assignment. Program a Genetic Algorithm to find an integer number between…
A: int select (int popsize, double sumfitness,pouplation pop) { partSum=0; rand= Random*sumfitness;…
Q: Consider the following statements: T(x. y): "x eats y". A(x): "x is wise". S(x): "x is hungry".…
A: The symbolic for the given sentence is as follows.
Q: there is a ternary operator like this int x= a>b ? a : b ; so there is 3 number ,x,,y,z if…
A: so, here we have to convert the if-else logic code to , using Ternary Operator code. we can do it…
Q: Let the function fun be defined as int fun(int *k) { *k += 5; return 3 * (*k) - %; } Suppose fun is…
A: The answer is as follows:-
Q: 1- Let A = [2: 0.5: 4],and B=B(2:4). What are the value of a ,and B?
A: A will consist of values from 2 to 4 at interval of 0.5 Here ,B is not defined earlier However…
Q: We have n glasses which can hold a varying amount of liquid. We will say that glass1 is size q1…
A: Solution: Given a quantity of liquid, we need to find out whether the given quantity can be…
Q: In the presidential elections for the United States of America, there are two types of votes: 1.…
A: The three classes fstream, ifstream, and ofstream, which are provided in the fstream headerfile, are…
Q: Consider the following recursive function: void exercise(int x) { if (x > 0 && x <…
A: The function exits when the parameter is outside the range or else the value is printed and function…
Q: 1. Give the unifyiing substitition for (x,y,z are variables): f(a) f(b) 2. Give the unifyiing…
A: (a) Here is a substituition that unifies these: { x -> a, y -> f(a), z -> f(a)} This…
Q: Trace through the following program and Show the Ol public class Employee { private static int empID…
A: public class Employee{ private static int empID = 11111; private String name, position;…
Q: 1. Define a function extract_grade(x): • x: A string containing a student number and grade in the…
A: We need to Define a function extract_grade(x) , class_average(final_marks) ,std_dev(final_marks):
Q: 05: Consider the following Java program: public void fun(void) { int a, b, c; /* definition 1 */ ...…
A: The java program: public void fun(void) { int a, b, c; /* definition 1 */ . . . while (.…
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- 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.)Coral Help Primary U.S. interstate highways are numbered 1-99. Odd numbers (like the 5 or 95) go north/south, and evens (like the 10 or 90) go east/west. Auxiliary highways are numbered 100-999, and service the primary highway indicated by the rightmost two digits. Thus, the 405 services the 5, and the 290 services the 90. Given a highway number, indicate whether it is a primary or auxiliary highway. If auxiliary, indicate what primary highway it serves. Also indicate if the (primary) highway runs north/south or east/west. Ex: If the input is: 90 the output is: The 90 is primary, going east/west. Ex: If the input is: 290 the output is: The 290 is auxiliary, serving the 90, going east/west. Ex: If the input is: 0 or any number not between 1 and 999, the output is: 0 is not a valid interstate highway number.Months Given the current month X, find out what month it will be after Y months have passed. You may not use the following keywords: if, while, for. $ python month.py 13 It's currently January, in 3 months it will be April. $ python month.py 5 20 It's currently May, in 20 months it will be January. $ python month.py 12 12 It's currently December, in 12 months it will be December.
- Interest on a credit card’s unpaid balance is calculated using the average daily balance. Suppose that netBalance is the balance shown in the bill, payment is the payment made, d1 is the number of days in the billing cycle, and d2 is the number of days payment is made before billing cycle. Then, the average daily balance is: averageDailyBalance = (netBalance * d1 – payment * d2) / d1 If the interest rate per month is, say, 0.0152, then the interest on the unpaid balance is: interest = averageDailyBalance * 0.0152 Instructions Write a program that accepts as input netBalance, d1, payment, d2, and interest rate per month (interestRate). The program outputs the interest. Format your output to two decimal places. Input: 100 30 50 7 9.7 Output: 856.83 Test case 2: Input: 255.76 31 55 3 12.3 output: 3080.38Interest on a credit card’s unpaid balance is calculated using the average daily balance. Suppose that netBalance is the balance shown in the bill, payment is the payment made, d1 is the number of days in the billing cycle, and d2 is the number of days payment is made before billing cycle. Then, the average daily balance is: averageDailyBalance = (netBalance * d1 – payment * d2) / d1 If the interest rate per month is, say, 0.0152, then the interest on the unpaid balance is: interest = averageDailyBalance * 0.0152 Write a program that accepts as input netBalance, d1, payment, d2, and interest rate per month (interestRate). The program outputs the interest. Format your output to two decimal places.Credit Card Number Check. The last digit of a credit card number is the check digit, which protects against transcription errors such as an error in a single digit or switching two digits. The following method is used to verify actual credit card numbers but, for simplicity, we will describe it for numbers with 8 digits instead of 16:• Starting from the rightmost digit, form the sum of every other digit. For example, if thecredit card number is 4358 9795, then you form the sum 5 + 7 + 8 + 3 = 23.• Double each of the digits that were not included in the preceding step. Add all digits ofthe resulting numbers. For example, with the number given above, doubling the digits,starting with the next-to-last one, yields 18 18 10 8. Adding all digits in these valuesyields 1 + 8 + 1 + 8 + 1 + 0 + 8 = 27.• Add the sums of the two preceding steps. If the last digit of the result is 0, the number isvalid. In our case, 23 + 27 = 50, so the number is valid.Write a program that implements this…
- Credit Card Number Check. The last digit of a credit card number is the check digit, which protects against transcription errors such as an error in a single digit or switching two digits. The following method is used to verify actual credit card numbers but, for simplicity, we will describe it for numbers with 8 digits instead of 16:• Starting from the rightmost digit, form the sum of every other digit. For example, if thecredit card number is 4358 9795, then you form the sum 5 + 7 + 8 + 3 = 23.• Double each of the digits that were not included in the preceding step. Add all digits ofthe resulting numbers. For example, with the number given above, doubling the digits,starting with the next-to-last one, yields 18 18 10 8. Adding all digits in these valuesyields 1 + 8 + 1 + 8 + 1 + 0 + 8 = 27.• Add the sums of the two preceding steps. If the last digit of the result is 0, the number isvalid. In our case, 23 + 27 = 50, so the number is valid.Write a program that implements this…Assume x is 10, y is 7, and z; x and y are int, z is bool. What is assigned to z? z = x < yPrimary U.S. interstate highways are numbered 1-99. Odd numbers (like the 5 or 95) go north/south, and evens (like the 10 or 90) go east/west. Auxiliary highways are numbered 100-999 and service the primary highway indicated by the rightmost two digits. Thus, the 405 services the 5, and the 290 services the 90. Given a highway number, indicate whether it is a primary or auxiliary highway. If auxiliary, indicate what primary highway it serves. Also, indicate if the (primary) highway runs north/south or east/west. Ex: If the input is: 90 The output is: The 90 is primary, going east/west. Ex: If the input is: 290 The output is: The 290 is auxiliary, serving the 90, going east/west. Ex: If the input is: 0 Or any number not between 1 and 999, the output is: 0 is not a valid interstate highway number. import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int highwayNumber; int…
- Summary Interest on a credit card's unpaid balance is calculated using the average daily balance. Suppose that netBalance is the balance shown in the bill, payment is the payment made, d1 is the number of days in the billing cycle, and d2 is the number of days payment is made before billing cycle. Then, the average daily balance is: averageDailyBalance = (netBalance * d1 payme If the interest rate per month is, say, 0.0152, then the interest on the unpaid balance is: interest averageDailyBalance * 0.0152 Instructions Write a program that accepts as input netBalance, d1, payment, d2, and interest rate per month ( interestRate).Python Assignment: In India McDonald's has the n number of customers and they are famous for their taste and quality so they plan to Organise the challenge for foody people. What is the challenge is?| you have taken a food challenge from the Chef and now you have to eat directly the Y burgers. You will eat as follows: At the first minute you will eat exactly the X burgers and every minute after that you will eat twice the number of burgers you ate the minute before. As you can get tired of food, Chef also lets you take a break from eating for one minute. When you start eating again after a break, your food streaks are reset, which means that in the first minute after the break you will eat X burgers and every minute after that you will eat the burgers you ate twice the last minute. Allow a1, a2, ., let it be your meal length in minutes. The cook needs to have all the ai different in pairs. Get the minimum number of minutes you need to eat Y burgers directly or decide that it is not…Interest on a credit card’s unpaid balance is calculated using the average daily balance. Suppose that netBalanceis the balance shown in the bill, paymentis the payment made, d1is the number of days in the billing cycle, and d2is the number of days payment is made before the billing cycle. Then the average daily balance is: averageDailyBalance = (netBalance * d1 –payment * d2) / d1 if the interest rate per month is say, 0.0152, then the interest on the unpaid balanceis: interest = averageDailyBalance * 0.0152 Design a program that accepts as input netBalance, payment, d1, d2, and interest rate per month. The program outputs the interest charged. Format your output to two decimal places. C++