CHALLENGE
ACTIVITY
3.3.4: Multiple if statements: Print car info.
Write multiple if statements. If carYear is 1969 or earlier, print "Probably has few safety features." If 1970 or higher, print "Probably has seat belts." If 1990 or higher, print "Probably has anti-lock brakes." If 2000 or higher, print "Probably has air bags." End each phrase with period and newline. Ex: carYear = 1995 prints:
Probably has seat belts. Probably has anti-lock brakes.
import java.util.Scanner;
public class CarFeatures {
public static void main (String [] args) {
int carYear = 0;
carYear = 1940;
/* Your solution goes here */
return;
}
}
import java.util.Scanner;
public class CarFeatures {
public static void main (String [] args) {
int carYear = 0;
carYear = 1940;
if(carYear<=1969){
System.out.println("Probably has few safety features.");
}
if(carYear >= 1970){
System.out.println("Probably has seat belts.");
}
if(carYear>=1990){
System.out.println("Probably has anti-lock brakes.");
}
if(carYear >= 2000){
System.out.println("Probably has air bags.");
}
return;
}
}


CHALLENGE ACTIVITY 3.3.4: Multiple if statements: Print car info. Write multiple if statements. If carYear is...
Write multiple if statements: If carYear is before 1967, print "Probably has few safety features." (without quotes). If after 1970, print "Probably has seat belts.". If after 1990, print "Probably has electronic stability control.". If after 2002, print "Probably has airbags.". End each phrase with period and newline. Ex: carYear = 1995 prints: Probably has seat belts. Probably has electronic stability control. the answer: #include <iostream> using namespace std; int main() { int carYear; carYear = 2001; /* Your solution...
Reset Write multiple if statements: If carYear is before 1968, print 'Probably has few safety features' (without quotes). If after 1969, print Probably has head rests." If after 1992, print "Probably has electronic stability control. If after 2001, print 'Prodably has tire- pressure monitor End each phrase with period and newline. Ex carYear 1995 prints Probably has head rests. Probably has electronic stability control. sinclude ciostream 2 using nanespace std int main) 7 carYear 1979 9Your solution goes here/ s...
in java
Feedback? CHALLENGE ACTIVITY 5.2.2: Printing array elements. Write three statements to print the first three elements of array run Times. Follow each statement with a newline. Ex: If runTime = (800,775, 790, 805, 808) print: 800 775 790 Note: These activities will test the code with different test values. This activity will perform two tests, both with a 5 element array. See 'How to Use zyBooks". Also note: If the submitted code tries to access an invalid array...
CHALLENGE ACTIVITY 3.11.1: Using boolean. D Assign is Teenager with true if kidAge is 13 to 19 inclusive. Otherwise, assign is Teenager with false. 1 import java.util.Scanner; 3 public class TeenagerDetector 1 public static void main (String [] args) { Scanner scnr = new Scanner(System.in); boolean isTeenager; int kidAge; D}]oll kidage = scnr.nextInt(); /* Your solution goes here */ Go USB if (isTeenager) { System.out.println("Teen"); else { System.out.println("Not teen"); 20 Run Feedback? CHALLENGE ACTIVITY 3.11.2: Boolean in branching statements. Write...
Write an if-else statement that checks patronAge. If 55 or greater print 'Senior citizen', otherwise print 'Not senior citizen' (without quotes). End with newline. 1 import java.util.Scanner; Test pas public class DetectSenior public static void nain (String[] args) { Scanner sehr = new Scanner(System.in); int patronage; patronage - ser.nextInt(); * Your solution goes here */ 12 13 Write an if-else statement with multiple branches. If given Year is 2101 or greater print 'Distant future" (without quotes). Else, if given Year...
In JAVA
ACTIVITY 3.10.1: Rock-paper-scissors. Write a switch statement that checks nextChoice. If o print "Rock". If 1 print "Paper". If 2 print "Scissors'. For any other value, print "Unknown'. End with newline. 2. 4 1 import java.util.Scanner; 3 public class Roshambo public static void main(String [] args) { 5 Scanner scnr - new Scanner(System.in); 6 int nextChoice; 7 8 nextChoice - scnr.nextInt(); 9 10 /" Your solution goes here */ 11 12 13} CHALLENGE ACTIVITY 3.10.2: Switch statement to...
Write three statements to print the first three elements of array runTimes. Follow each statement with a newline. Ex: If runTime = {800, 775, 790, 805, 808}, print: 800 775 790 Note: These activities will test the code with different test values. This activity will perform two tests, both with a 5-element array. See "How to Use zyBooks". Also note: If the submitted code tries to access an invalid array element, such as runTimes[9] for a 5-element array, the test...
Java : I keep getting something wrong in my loadfile method, how do I fix my code? Thank you. here is what is contained in the text file (WorldSeriesWinners.txt) 112 1903 Boston Americans 1904 No World Series 1905 New York Giants 1906 Chicago White Sox 1907 Chicago Cubs 1908 Chicago Cubs 1909 Pittsburgh Pirates 1910 Philadelphia Athletics 1911 Philadelphia Athletics 1912 Boston Red Sox 1913 Philadelphia Athletics 1914 Boston Braves 1915 Boston Red Sox 1916 Boston Red Sox 1917 Chicago...
write a SQL statements to perform the following: Select all years a World Series game was played Select all losing teams that played in a World Series game Select all winning and losing teams that played in a World Series game Select all cities of a winning or losing team that played in a World Series game Select all winning and losing teams that played in a World Series game, and provide aliases of "Winning Team" and "Losing Team" Select...
Write MySQL query statements for the questions below including
the output that proves the accuracy of your solution. Your answers
should be stored in a text file that captures your interaction with
MySQL.
1. Find the movieID, title, year and DVDPrice of all movies
where the DVD-Price is equal to the discountPrice.
2. Find the actorID, lastName, firstName, middleName, and suffix
of all actors whose middleName is not NULL.
3. Suppose you remember a movie quote as “Play it again,...