Write multiple if statements: If carYear is before 1968, print "Probably has few safety features." (without quotes If after 1969, print "Probably has seat belts.". If after 1991, print "Probably has anti-lock brakes.". If after 2001, print "Probably has tire-pressure monitor.". End each phrase with period and newline. Ex: carYear = 1995 prints: %3D Probably has seat belts. Probably has anti-lock brakes.
Q: PYTHON-Write multiple if statements: If car_year is before 1968, print "Probably has few safety…
A: Given: PYTHON-Write multiple if statements: If car_year is before 1968, print "Probably has few…
Q: re the following Boolean expressions true or false? (circle instanceof GeometricObject)
A: when you will create a circle class and GeometricObject class and you will create objects for both…
Q: The annual rate of inflation is the rate at which money loses its value. For example, if the annual…
A: PROGRAM CODE: #include <iostream>#include <iomanip>using namespace std; int main(){…
Q: Complete the following program that finds which of the time points comes last. The time is expressea…
A: correct statements are: time1="12:00"time2="00:55"hh1,mm1 = time1.split(":")hh2,mm2 =…
Q: Q2: If you know that the marks should be included as follows: Brand The ratio A 100-90 B 90-80 C…
A: As the programming language is not mentioned here, we are using PYTHON The code and output…
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: What will be the value of pay after the following statements executed? int hours = 41; double pay,…
A: What will be the value of pay after the following statements executed?
Q: Rewrite the following statement with an if/else statement: total += count = = 1? sales : count *…
A: if((total+count)==1) { Print sales; } else { Print count * sales; }
Q: OBJECT: To compute the net pay of an employee, given his/her pay rate, number of hours, and…
A: OBJECT: To compute the net pay of an employee, given his/her pay rate, number of hours, and…
Q: A programmer wants to determine whether a score is within 10 points of a given target. For example,…
A: Answer is option D (target-10 ≤ score) AND (score ≤ target +10 )
Q: Write a program that determine the bonus amount using a nested if-else statements . For hourly…
A: As no programming language is mentioned, it is solved using basic C++
Q: Question 1 Write a program which takes the input from the user of time and distance and calculate…
A: here in this question we have asked to write a program which take input from the user of time and…
Q: Write a program that reads in an investment amount, the annual interest rate, and the number of…
A: PROGRAM CODE: import java.util.Scanner; public class Main { public static void main(String[] args) {…
Q: 3. What is the value of the price variable after the following code snippet is executed? int price…
A: If-else statements determine whether the if expression is true or false. If it is true, then the if…
Q: True or False? The expression ! (x > 0) is true only if x is a negative number.
A: Verify the statement given, The expression ! (x > 0) is true only if x is a negative number.
Q: write a program that enters the test score and display excellent, very good, good, fair. poor, or…
A: I give the code in Python along with output and code screenshot
Q: Suppose you deposit a certain amount of money into a savings account that earns compound monthly…
A: The below-given javascript program will obey the following rubrics: Declaring a function,…
Q: Test the following program for different values and identify the error. int main() { double…
A: I have given an answer in step 2.
Q: a. Write the statement in symbolic form Assign letters to simple statements that are not negated…
A: The answer is given below.
Q: int bonus, sales 15000 if (sales < 5000) bonus - 200 else if (sales < 7500) bonus - 500 else if…
A: Value of sales = 15000 Condition 1 : if ( sales < 5000) => false because 15000 > 5000…
Q: Rewrite each of the following statements in the form “If A, then B.”a. Candidate Lu winning the…
A: If…Then statement: It is the simplest form of control statement. It is mainly used for decision…
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: Suppose you want to deposit a certain amount of money into a savings account and then leave it alone…
A: PROGRAM: #include <bits/stdc++.h> #include <iostream> #include <stdio.h> using…
Q: An argument is expressed in English below. Sara is not excited. If Sara is not excited, then Sara…
A: Ans.) Sara is not excited == ~q If sara is not excited, than she will go to party== ~q --> r…
Q: Write a program that display the letter grade (A if number bigger than 90, B if number bigger than…
A: Here, I am going to write a python program to print the grade when a user enters the number.
Q: Write if statements for each of the following. Possible outcomes are underlined. The if statements…
A: Note: Possible outcomes is not underlined. for last part is not clear[it look incomplete] 1.…
Q: Q1/ Indicate what is acceptable and what is not acceptable from the following variables with an…
A: Variable Names can have upper case and lower case letters or digits or underscore Variable Names…
Q: Write the statement in words if: p: Firemen work hard. q: Firemen wear red suspenders 3) ~p → q
A: Please refer to the following step for the complete solution of the problem above.
Q: Test the following program for different values and identify the error. int main() { double…
A: I have given an answer in step 2.
Q: Write a program that will take as input the type of restaurant the user ate at, the cost of the…
A: Use if else if conditions to check each type and add tax in every case
Q: PartA part B What is the value of Y after solving the following expression? Y= Not 15 Mod 5 = 24/6…
A: - We need to highlight the correct option amongst the provided ones for the expression. - In part…
Q: Write a regular expression that matches the day of year such as "1-1-2018" or "7/4/1776". Dates like…
A: Solution: Given,
Q: Write a method named presentValue that performs this calculation. The method should accept the…
A: We know that the amount we get for a principal P after t years is P + PTR/100 So, according to the…
Q: Jump to level1 Write multiple if statements: If car_year is before 1967, print "Probably has few…
A: NOTE: Since programming, langauge is not mentioned. Therefore answering questions in Python…
Q: A student took four quizzes in a term and would like to compute their average. He also would like to…
A: 1. Input marks of 4 quiz 2. Add the marks of 4 quiz to get the total(tot) 3. Divide the add value…
Q: |The statements select RIGHT('l wish I had attended the practice hours', 9) and select…
A: I have provided a solution in step2.
Q: Write a program that prompts the user to enter the distance todrive, the fuel efficiency of the car…
A: Program Plan: importing the libraries of utility class for scanner and other mathematical…
Q: ACTIVITY Write an if-else statement with multiple branches. If year is 2101 or later, print "Distant…
A: Answer is given below .
Q: Test if the value of the variable age is greater than 18 and less than or equal to 40. If it is,…
A: According to the Question below the Solution: Output:
Q: If the number of items bought is less than 5, then the shipping charges are $7.00 for each item…
A: Correct code Here shipping charges are $7.00 for each item, if the number of items is less than 5.…
Q: Write out an IF-THEN-ELSE statement for the following conditions: 1. A person has credit card points…
A: Let's understand step by step : Answer (1) : 1. The Points_available will be the integer variable…
Q: Answer the following true/false questions using the following code. And state why it is true or…
A: 1. Yes we can tell what type of variable match is by seeing the above code. True 2. Yes we can tell…
Q: The following statements are intended to alert a user to dangerously high oral thermometer readings…
A: Matlab: Matlab stands for MATrix LABoratory. The purpose of MATLAB is used to perform engineering…
Q: int x, y, z; x-3; int a, b, z; a=l; b-4; y=7; z=9; if(x>y) if(x-y4) while (acb) { a=2*a; b=b+l;…
A: given code on c++ we need to provide the output of the codes, please see the answer in step 2. note:…
Q: e the following question correctly with detail please.
A: Binary number to Gray code a) 11011 Procedure Step1. The Most Significant Bit(MSB) of binary code…
Q: Write a program that ask the user to enter his/her letter grade and then respond with an appropriate…
A: grade = input("Enter your grade : ") #taking user inputif(grade == 'a' or grade == 'A'):…
Q: Write the statement in words if: p: Firemen work hard. q: Firemen wear red suspenders. 1) ~q 2) p…
A: Tilde sign is used for negation which represents negation of a sentence. ∧ logic combines two or…
Q: You have 3 buckets, the first of size 4 gallons, the second of size 10 gallons and the third of size…
A: Question:
Q: Suppose that overSpeed and fine are double variables. Assign the value to fine as follows: If 0 15,…
A: Explanation: The given scenario is achieved through “if-else-if” statement. Here, the two variables…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- 4. A) What will be the value of x after the following code is executed? int x, y = 4, z = 6; x = (y++) * (++z); B) Suppose a = 1. What is the value of a after the following code executes? Show the procedure to reach your answer if(a > 0) { switch(a) { case 1: a = a + 3; case 3: a++; case 6: a = a * 2; break; case 8: a--; break; default a++; } else a = a + 2; C) What would be the value of x after the following statements were executed? int x = 10; switch (x) { case 10: x += 15; case 12: x -= 5; break; default: x *= 3; }2.1.3: Basic if-else. Jump to level 1 Write an if-else statement for the following: If userTickets is less than 8, execute awardPoints = 1. Else, execute awardPoints = userTickets. Ex: If userTickets is 3, then awardPoints = 1. 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. if (userTickets < 8) { awardPoints = 1; System.out.println(awardPoints); } else { System.out.println(awardPoints); }}1)Write a shell scriptthat calculate electricity bill.The rates of electricity per unit are as follows: Consume-units>=300 then cost is Rs. 2 per unit Consume-units>300 and <=500 then cost is Rs. 5 per unit Consume-units>500 then cost is Rs. 7 per unit. 2)write a shell script that inputs Salary and Grade. It adds 50% bonus if the gradeis greater than 15. It adds 25% bonus if the grade is 15 or less and then display the total salary. 3)write a shell script that inputs three number and display the maximum number.E
- Write an if-else statement with multiple branches. If givenYear is 2101 or greater, print "Distant future" (without quotes). Else, if givenYear is 2001 or greater (2001-2100), print "21st century". Else, if givenYear is 1901 or greater (1901-2000), print "20th century". Else (1900 or earlier), print "Long ago". Do NOT end with newline. import java.util.Scanner; public class YearChecker {public static void main (String [] args) {Scanner scnr = new Scanner(System.in);int givenYear; givenYear = scnr.nextInt();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); }}1. Assume x is an int which has been declared and assigned a valid value. x guaranteed to change after this code snippet. if (x<5) x--; if (x>=5) cout << x + 1; a) True b) False 2. Assume x is an int which has been declared and assigned a valid value. x guaranteed to change after this code snippet. if (x<5) x--; if (x>=5) x++; a) True b) False
- PYTHON-Write multiple if statements: If car_year is before 1968, print "Probably has few safety features." (without quotes). If after 1969, print "Probably has seat belts.". If after 1992, print "Probably has anti-lock brakes.". If after 2001, print "Probably has airbags.". End each phrase with period and newline. Remember that print() automatically adds a newline. Ex: car_year = 1995 prints: Probably has seat belts. Probably has anti-lock brakes.1. State the value of x after the staement if P(x) then x := 1 is executed, where P(x) is the statement "x>1," if the value of x when this statement is reached is x=0 2. Let Q(x) be the statement " x+1 > 2x." If the domain consists pf the integers, what are these truth values? ∀xQ(x) 3. Determine the truth value of each of these statements if the domain of each variable consists of all real numbers. ∀x(x^2+2≥1) 4. suppose that the domain of the propositional function P(x) consists of the integers -2,-1,0,1, and 2. Write out the proposition using disjunctions, conjunctions, and negations. ∀xP(x) 5. Translate this statement into a logical expressions using predicates, quantifiers, and lofical connectives. Something is not in the correct place.We have recently walked through a simple if statement block that results to a value based on the input given. The script is shown again in Snippet 3.11: python3_year = 2008year = int(input('When was Python3 first released?')) if year == python3_year: print('That is correct.')elif year > python3_year: print('Incorrect, too late.')elif year < python3_year: print('Incorrect, too early.')print('Have a great day!') Snippet 3.11 Modify this block as follows: • The user prompt should be Return TRUE or FALSE: Python3 was released in 2008:. • If the user inputs TRUE, print out Correct. • If the user inputs FALSE, print out Incorrect. • Any other user input should result in Please answer TRUE or FALSE. Go to your main.py file and add your code to it. Then, run it in a terminal. The output should look like Snippet 3.12: python3 main.py Return TRUE or FALSE: Python3 was released in 2008: TRUE CorrectHave a great day! python3 main.py Return TRUE or FALSE: Python3 was released in…
- CHALLENGE ACTIVITY 4.4.5: Multi-branch if-else statements: Print century. Write an if-else statement with multiple branches.If year is 2101 or later, print "Distant future" (without quotes). Otherwise, if year is 2001 or greater, print "21st century". Otherwise, if year is 1901 or greater, print "20th century". Else (1900 or earlier), print "Long ago".Sample output with input: 1776 Long agoSuppose x, y, and z are int variables and w and t are double variables. What are the values of all five variables after all the following statements have been executed? Hint, the mod operator is the same level of precedence as * and /, and be careful about integer division. x = 17; y = 15; x = x + y / 4; z = x % 3 + 4; w = 17 / 3 + 6.5; t = x / 4.0 + 15 % 4 - 3.5;Java Program ************This program must work in hypergrade and pass all the test cases.********** Please modify this program down below because it does not pass all the test cases. I have provided the failed test cases and the correct test case as a screenshot. import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.io.InputStreamReader; // Import InputStreamReaderpublic class WordSeparator { public static void main(String[] args) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) { String inputFileName; while (true) { System.out.print("Please enter the file name or type QUIT to exit:\n"); inputFileName = reader.readLine(); if (inputFileName.equalsIgnoreCase("QUIT")) { break; } try { BufferedReader fileReader = new BufferedReader(new…