3. Suppose 'p' denotes the statement "you were 90 on your last birthday" and 'q' denotes the statement "you are over 21": If you are over 21, then you were 90 on your last birthday. The statement is. * Inverse Contradiction Contrapositive Converse None of the above
Q: Q2: Write a program in C++ to read ten students' name and degrees then calculate the average degree…
A: The program has to be designed as follows: Create arrays for storing names of students. Create…
Q: Write a multiple assignment statement that can be used instead of the followinggroup of assignment…
A: GIVEN: Write a multiple assignment statement that can be used instead of the followinggroup of…
Q: A number N can be categorized as Deficient, Perfect or Abundant Number based on the following…
A: Expect the number itself, any factor of a number is called proper factor. All factors of the number…
Q: You are given a positive integer x. Check whether the number x is representable as the amount of the…
A: Here have to determine about the sum of cube programming problem statement.
Q: Extend the BNF in the answer bax below to include: 1. if-then-else-end statements (in addition to…
A: Here i am fill the blanks: =============================== 1.statement=if | while | assignment|…
Q: 1. Evaluate !(1 && !(0 || 0)). (Answer True or False only) 2. The associativity rule of logical…
A: - We need to evaluate the expression given and define the associativity rule of logical operator.
Q: (De Morgan’s Laws) In this chapter, we discussed the logical operators &&, ||, and !.…
A: According to De Morgan's Law, !(condition1 && condition2) = (!condition1 || !condition2)…
Q: Write the form of the following argument. Is the argument valid or invalid? Justify your answer.…
A: The Answer is
Q: C. Read the following paragraph and write the correct preposition between brackets in the suitable…
A: Prepositions and postpositions, collectively are known as adpositions, and are a class of words that…
Q: Accept two integers and determine of the values are equal, if the values are equal print” EQUAL…
A: Introduction of Program: The C++ program takes two integers as input from the user and if both…
Q: Correct the errors in each of the following statements: 1- if ( age >= 65) cout> i>>j; **** *****
A: To correct the errors in the given statements: The given statement is: if ( age >= 65)…
Q: A(n) statements are used to construct a decision structure with two possible outcomes
A: A(n) statements are used to construct a decision structure with two possible outcomes.
Q: why are the following statements NOT considered to be disjunctive normal form? A * (B + ~C) ~(A +…
A: The answer for the given question is as follows.
Q: Write the correct syntax? while( a < 5 ): for (int i, i…
A: Write the correct syntax
Q: use c++ to answer the folloing question in an ancient land, the beautiful princess Eve had many…
A: Given data is shown below: use c++ to answer the following question in an ancient land, the…
Q: 4. In the following enum enum E { CO=0, C1=1, C2=2}; Overload the + operator to do the following…
A: #include<iostream>using namespace std; //Enum declarationenum E {C0=0 , C1=1 , C2=2};…
Q: Using any programming language, write a program that will solve the given problem below: Write a…
A: The answer is coded in Python Language.
Q: Write a negation for each of the following statements: (a) The variable S is undeclared and the…
A:
Q: End use to: OTerminates scope of if, and switch statements. OTerminates scope of switch, and non if…
A: Terminates scope of if, and switch statements. Terminates scope of switch, and non if statements.…
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: Having trouble with this c++ homework question. void a(int n) { if(n<1) { cout <<…
A: Having trouble with this c++ homework question. void a(int n) { if(n<1) { cout…
Q: Example 1: Write a C++ program to read student's mark and print "passed" if it is greater than 50.…
A: #include<iostream>using namespace std;int main(){ int mark; cout<<"Enter student's mark:…
Q: A truth table shows, for the various true or false values of boolean variables, what the result of a…
A: I have solved all the 8 parts of the truth table and have provided explanation along with it. We…
Q: 15. The statement A: p implies (not p) implies q) is O Tonly when p =T O none of these O always T O…
A: Answer: A: p implies ((not p) implies q) p->(~p ->q): Explanation: p q ~p ~p ->q…
Q: Using Java programming language write a program to manage a hotel with 24 rooms; 10 rooms are…
A: It is defined as
Q: BMI is a measure of body condition and it is related to a person's weight and height. In the metric…
A: This code is used to know the condition of person whether he’s healthy or obese. If the BMI is less…
Q: Question 4 Rewrite the following statement without using variables. Then, give an exam- ple that…
A: Solution - For the above question 4 and 5 we have to rewrite their statements without using…
Q: Total Occurrence Given two integer numbers input1 and input2, find the total number of OCcurrences…
A: Given: To write a program to find the total number of occurrences of input in a series of natural…
Q: Both players have to make substrings using the letters of the string S. Stuart has to make words…
A: Here is the PYTHON code as required I have kept it very simple to understand
Q: 1. Proof the following statement: I a) Let x E R. If x > 0, then x² + 2 > 0 b) Suppose n € Z. If n²…
A: Answer
Q: Question 2 Rewrite the following program using a switch-case statement #include int main() { long…
A: According to the Question below the Solution: Output:
Q: The set of premises and a conclusion are given. Use the valid argument forms to deduce the…
A:
Q: 10. Let p be the statement “He gets frustrated.” and q be the statement “He will be able to complete…
A: Here in this question we have given a logical statement and we have asked to convert into english…
Q: Question # 8: Write a program that inputs a number and checks whether it is a perfect number or not.…
A: Answer 8: Objective: The program reads the user input and verifies if the number falls under the…
Q: Consider the following statements: DATAENDFLAG is off; ERROR equals 0; and SUM is less than 1024.…
A:
Q: 1. Program the following. Make the number guessing program with switch case. Make an alphabet…
A: NOTE: According to the guidelines, only the first program is implemented. Program description: guess…
Q: Evaluate the following expression as either True or False taking into account operator precedence…
A: The expression evaluation and the operator precedence are given below.
Q: Q1: Rewrite the following sentences in the negative form .my family had to travel to Dubai last week…
A: Answer The negative form of the sentences are : 1) My family has not travelled to Dubai last week.…
Q: End use to: OTerminates scope of if, and switch statements. OTerminates scope of switch, and non if…
A: End is used to terminate the scope of any block of code that is inside either of function , if…
Q: Three forms of negation are given for each statement. Which is correct?a. Some people like…
A: a. Some people like mathematics. The correct option is 2. Everybody dislikes mathematics. If it is…
Q: State whether the following are valid switch statements. If not, explain why. Assume that n and…
A: Switch Statements: Syntax for the switch statement is: switch(expression) { case X:…
Q: Consider statements p and q. p: Mary is practicing golf. q: Aldo is dancing. For parts (a) and (b),…
A: Consider statements p and q.
Q: 1. Consider the following statements: DATAENDFLAG is off; ERROR equals 0; and SUM is less than 1024.…
A:
Q: In python, an important feature of an if statement with elif clauses is that once a condition…
A: if-elif statements are known as conditional statements
Q: (JAVA)A set of if statements can do the same job as a switchstatement. What is a good reason to…
A: Switch statement: It can be purely depend on the condition of a certain variable. The variables…
Q: What is the difference between a suffient and necessary statement? Pleae give good examples
A: Step 1 The answer is given in the below step
Q: Let T be the statement ∀ real numbers x, if − 1 0. Write the converse of T. Write the…
A: writing it below
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.)Define an enumeration type triangleType that has the values scalene, isosceles, equilateral, and noTriangle. Write a function triangleShape that takes as parameters three numbers, each of which represents the length of a side of the triangle. The function should return the shape of the triangle. (Note: In a triangle, the sum of the lengths of any two sides is greater than the length of the third side.) Write a program that prompts the user to input the length of the sides of a triangle and outputs the shape of the triangleThe card game “War” is played by the following rules (you may have learned different rules. Use these): - Each player gets half of the deck of cards (in our case, a set of random integers with value 1-13) - The game itself is played in a series of “rounds”. In each round: o Both players draw a card, putting it into the “reward pile” (and removing it from their hand). o If one player’s card is higher than another, they gain all cards in the reward pile (and add it to their hand) o If there is a tie, both players add an additional card to the reward pile (which is not compared - I call this a “penalty card” in my sample run below), and then we begin a new round with a larger reward pile. The next round’s winner will win the entire reward pile (though it is possible to have multiple consecutive ties, leading to a much larger reward pile) - The game ends when a player needs to draw a card and cannot. That player loses. Your task is to implement this game with the player’s hands and the…
- Part 2 - OddOrEven ClassIn bluej. Write a program that prompts the user to enter an integer. The program should display “The input is odd" to the screen if the input is odd and displays “The input is even" to the screen if the input is even. Hint: Consider using the mod (%) operator.Define an enumeration type, triangleType, that has the values scalene, isosceles, equilateraland noTriangle. Write a function triangleShape that takes as parameters three numbers, each of which represents the length of a side of the triangle. The function should return the shape of the triangle. (Note, ina triangle, the sum of the lengths of any two sides is greater than the length of the third side). Write a program that prompts the user to input the length of the sides of a triangle and outputs the shape of the triangle. The user can enter the sides in no particular order. C++X4: teaParty Write a function in Java that implements the following logic: We are having a party with amounts of tea and candy. Return the int outcome of the party encoded as 0 = bad, 1 = good, or 2 = great. A party is good (1) if both tea and candy are at %3D least 5. However, if either tea or candy is at least double the amount of the other one, the party is great (2). However, in all cases, if either tea or candy is less than 5, the party is always bad (0). Your Answer: 1 public int teaParty(int tea, int candy) 2 { 3 4 }
- Do not use regular expressions in your solution for this exercise. Write a program that checks to see if an input password is valid or not. In this exercise, a valid password has the following characteristics: It contains at least eight characters. It contains at most 12 characters. It contains only alphabetic characters, digits and the underscore (‘_’) character. It does not start with a digit. It has a mix of upper-case and lower-case characters. Your class must contain the following method: public static String checkPassword(String input) This method receives a possible password as input and returns only the String“OK” if the password is valid. If the password is not valid then you can return the reason(s) for that as the return value. This is not a part of the requirements, however, and you don’t need to do that. You can simply return null for an invalid password.Python tic tac toe. Tic tac toe is a very popular game. Only two players can play at a time. Game Rules Traditionally the first player plays with "X". So you can decide who wants to go with "X" and who wants to go with "O". Only one player can play at a time. If any of the players have filled a square then the other player and the same player cannot override that square. There are only two conditions that may match will be a draw or may win. The player that succeeds in placing three respective marks (X or O) in a horizontal, vertical, or diagonal row wins the game. Winning condition Whoever places three respective marks (X or O) horizontally, vertically, or diagonally will be the winner. Submit your code and screenshots of your code in action. Hints : Have a function that draws the board Have a function that checks position if empty or not Have a function that checks player or won or not expected output:X4: teaParty Write a function in Java that implements the following logic: We are having a party with amounts of tea and candy. Return the int outcome of the party encoded as 0 = bad, 1 = good, or 2 = great. A party is good (1) if both tea and candy are at least 5. However, if either tea or candy is at least double the amount of the other one, the party is great (2). However, in all cases, if either tea or candy is less than 5, the party is always bad (0).
- INSTRUCTIONS: Write a C++ script/code to do the given problems. MOVIE PROBLEM: Write a function that checks whether a person can watch an R18+ rated movie. One of the following two conditions is required for admittance: The person is atleast 18 years old. • They have parental supervision. The function accepts two parameters, age and isSupervised. Return a boolean. Example: acceptIntoMovie(14, true) → true acceptIntoMovie(14, false) → falseAIM: TO SWAP 2 NUMBERS WITHOUT USE OF TEMPORARY VARIABLE THEORY: C is a general-purpose, middle level, procedural computer programming language supporting structured programming, lexical variable scope, and recursion, with a static type system. C is an imperative procedural language. Let a and b be variables in which integral values are being inserted . tw numbers can be swapped without using a temporary variable by using arithmetic operations. Another alternative method is by use of logical operators. ALGORITHM: STEP 1: Start STEP 2:Print "Enter two numbers'" STEP 3: Input x,y STEP 4:Print “ Numbers x,y before swapping STEP 5: x x+y STEP 6: y<– x-y STEP 7: x x-y STEP 8: Print “ Numbers x,y after swapping " STEP 9: StopWhich rule is used in the argument below? • Alice is a student in the class. • Alice got an A on the test and did not study. • Therefore, there is a student in the class who got an A on the test and did not study. Select one: O Universal generalization O Existential generalization O Existential instantiation O Universal instantiation