1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
labwork [276]
3 years ago
8

Consider the following classes: public class Vehicle {...} public class Car extends Vehicle {...} public class SUV extends Car {

...} Self-Check Problems 617 Which of the following are legal statements? a. Vehicle v = new Car(); b. Vehicle v = new SUV(); c. Car c = new SUV(); d. SUV s = new SUV(); e. SUV s = new Car(); f. Car c = new Vehicle();
Computers and Technology
1 answer:
Kitty [74]3 years ago
7 0

Answer:

Legal statements:

      SUV s = new SUV();

      Car c = new SUV();

      Vehicle v = new SUV();

      Vehicle v1 = new Car();

illegal statements:

      SUV s1 = new Car();

      Car c1 = new Vehicle();

Explanation:

The options a, b, c, d are correct and legal statements because the syntax is correct, they follow the inheritance principles and therefore can be used for type cast.

The options e, f are incorrect and illegal statements because they do not follow the inheritance principles and therefore can not be used for type cast.

You might be interested in
PLEASE HELP
Lunna [17]

Answer:

Spreadsheets is a software like Microsoft excel

3 0
2 years ago
Read 2 more answers
What things can you do when creating a PowerPoint presentation to assure that your work adds to the speaker’s presentation witho
tatiyna
Don’t crowd the slide, use images that will grab them audience’s attention, don’t use fonts that are hard to read, make sure your font color can show up on your background color!
6 0
3 years ago
(Displaying a Sentence with Its Words Reversed) Write an application that inputs a line of text, tokenizes the line with String
Serjik [45]

Answer:

I am writing a JAVA and Python program. Let me know if you want the program in some other programming language.

import java.util.Scanner; // class for taking input from user

public class Reverse{ //class to reverse a sentence

public static void main(String[] args) { //start of main() function body

Scanner input = new Scanner(System.in); //create a Scanner class object

   System.out.print("Enter a sentence: "); //prompts user to enter a sentence

   String sentence = input.nextLine(); // scans and reads input sentence

   String[] tokens = sentence.split(" "); // split the sentence into tokens using split() method and a space as delimiter

   for (int i = tokens.length - 1; i >= 0; i--) { //loop that iterates through the tokens of the sentence in reverse order

       System.out.println(tokens[i]); } } } // print the sentence tokens in reverse order

Explanation:

In JAVA program the user is asked to input a sentence. The sentence is then broken into tokens using split() method. split method returns an array of strings after splitting or breaking the sentence based on the delimiter. Here the delimiter used is space characters. So split() method splits the sentence into tokens based on the space as delimiter to separate the words in the sentence. Next the for loop is used to iterate through the tokens as following:

Suppose the input sentence is "How are you"

After split() method it becomes:

How

are

you

Next the loop has a variable i which initialized to the tokens.length-1. This loop will continue to execute till the value of i remains greater than or equals to 0.

for (int i = tokens.length - 1; i >= 0; i--)

The length of first token i.e you is 3 so the loop executes and prints the word you.

Then at next iteration the value of i is decremented by 1 and now it points at the token are and prints the word are

Next iteration the value of i is again decremented by i and it prints the word How.

This can be achieved in Python as:

def reverse(sentence):

   rev_tokens = ' '.join(reversed(sentence.split(' ')))

   return rev_tokens

   

line = input("enter a sentence: ")

print((reverse(line)))

The method reverse takes a sentence as parameter. Then rev_tokens = ' '.join(reversed(sentence.split(' ')))  statement first splits the sentence into array of words/tokens using space as a delimiter. Next reversed() method returns the reversed sentence.  Next the join() method join the reversed words of the sentence using a space separator ' '.join(). If you want to represent the reversed tokens each in a separate line then change the above statement as follows:

rev_tokens = '\n'.join(reversed(sentence.split(' ')))  

Here the join method joins the reversed words separating them with a new line.

Simply input a line of text and call this reverse() method by passing the input line to it.

4 0
3 years ago
10. How does a command work in conjunction with a switch?
bulgar [2K]
Im not completely sure, but i believe the answer is b. Different switches can be used at different times which have different outputs. You could switch cases in one program and use a different one in another and get different outputs.
8 0
3 years ago
List at least three kinds of harm a company could experience from electronic espionage or unauthorized viewing of confidential c
Mamont248 [21]

The  three kinds of harm a company could experience from electronic espionage or unauthorized viewing of confidential company materials are:

  • Embarrassment and also the loss of customers as a result of data loss.
  • The loss of what we call a proprietary information.
  • The loss of what we call the sensitive business strategy information (such as  planned acquisitions, and other.).

<h3>What is E-espionage? </h3>

This  term e-Espionage is known to be a form of an unauthorized and it is often seen as a criminal access to a lot of confidential systems and information and it is one whose purpose is that they have or gain a lot of commercial or political advantage.

Hence, the types of espionage are:

  • Clandestine cell system.
  • Counterintelligence, etc.

Therefore, The  three kinds of harm a company could experience from electronic espionage or unauthorized viewing of confidential company materials are:

  • Embarrassment and also the loss of customers as a result of data loss.
  • The loss of what we call a proprietary information.
  • The loss of what we call the sensitive business strategy information (such as  planned acquisitions, and other.).

Learn more about electronic espionage from

brainly.com/question/312313

#SPJ1

3 0
1 year ago
Other questions:
  • What is technology and how does it work?
    7·1 answer
  • Given: an int variable k, an int array current Members that has been declared and initialized, an int variable memberID that has
    11·1 answer
  • With landscape photography, which depth of field do you normally want? A) Small B)Small to Medium C)Large D)With landscapes it d
    7·2 answers
  • San Diego broker Cal Abrams has avoided the technological trend of the past 20 years. Finally, he's jumped online and realized w
    14·1 answer
  • The birthday problem is as follows: given a group of n people in a room, what is the probability that two or more of them have t
    15·1 answer
  • Design a hierarchy of classes, where the Media superclass has the artistName and the mediaName as the common attributes. Create
    14·1 answer
  • What is the right age to start coding in high school?
    11·1 answer
  • 我对汉语的兴趣 làm đoạn văn theo đề trên​
    14·1 answer
  • Write a program that outputs a subtraction practice problem for a student, outputting the larger random number
    12·1 answer
  • (Java) Write a program that accepts a number of minutes and converts it both to hours and days. For example, 6000 minutes is 100
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!