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]
2 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]2 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
Write a MIPS assembly language program that accomplishes the following tasks:The program will prompt the user to enter an intege
Svetlanka [38]

Answer:

Here's the code below

Explanation:

# All the comment will start with #

# MIPS is assembly language program.

# we store the all the data inside .data

.data:

k: .asciiz "Enter the kth value:\n"

.text

.globl main

li $s0, 0 # $s0 = 0

li $t0, 0 # $t0 = 0

la $n0, k # $n0 is kth value address

syscall # call print_string()

li $v0, 0 # $v0

syscall

move $n0, $v0 # $a0 = user input or "int n"

addi $sp, $sp, -4 # move the stack pointer down

sw $ra, 0 ($sp) # save the return address for main

jal fncheck # call fncheck(n);

fncheck:

beq $n, 0, fnfirst #if n==0 then fnfirst

beq $n, 0, fnfirst #if n==0 then fnfirst

ble $n0, 5, fnrec # if (n <=5) then 5

bge $n0, 5, fnjoke

#first function for n 0 and 1

fnfirst:

li $t0, 0 # initialize $t0 = 0

addi $t0, $t0, 20 # $t0 = 20

move $v0, $t0 # return 20

jr $ra

#function to execute 5*function1(n-2) + n;

fnrec:

sub $sp, $sp, 12 # store 3 registers

sw $ra, 0($sp) # $ra is the first register

sw $n0, 4($sp) # $n0 is the second register

addi $n0, $n0, -2 # $a0 = n - 2

jal function1

sw $v0, 8($sp) # store $v0, the 3rd register to be stored

lw $n0, 4($sp) # retrieve original value of n

lw $t0, 8($sp) # retrieve first function result (function1 (n-2))

mul $t0, $t0, 5 # $t0 = 5 * function1(n-2)

add $v0, $v0, $t0

lw $ra, 0($sp) # retrieve return address

addi $sp, $sp, 12

jr $ra

#function to print joke

fnjoke:

la "Joke section"

4 0
3 years ago
Write a date transformer program using an if/elif/else statement to transform a numeric date in month/day format to an expanded
boyakko [2]

I wrote it in Python because it was quick so i hope this is helpful

Answer:

date = input('Enter Date: ')

split_date = date.split('/')

month = split_date[0]

day = split_date[1]

if month == '1':

   english_month = 'January'

   spanish_month = 'Enero'

elif month == '2':

   english_month = 'February'

   spanish_month = 'Febrero'

elif month == '3':

   english_month = 'March'

   spanish_month = 'Marzo'

elif month == '4':

   english_month = 'April'

   spanish_month = 'Abril'

elif month == '5':

   english_month = 'May'

   spanish_month = 'Mayo'

elif month == '6':

   english_month = 'June'

   spanish_month = 'Junio'

elif month == '7':

   english_month = 'July'

   spanish_month = 'Julio'

elif month == '8':

   english_month = 'August'

   spanish_month = 'Agosto'

elif month == '9':

   english_month = 'September'

   spanish_month = 'Septiembre'

elif month == '10':

   english_month = 'October'

   spanish_month = 'Octubre'

elif month == '11':

   english_month = 'November'

   spanish_month = 'Noviembre'

elif month == '12':

   english_month = 'December'

   spanish_month = 'Diciembre'

US_English = f'{english_month} {day}'

International_Spanish = f'{day} {spanish_month}'

print(f'US English Form: {US_English}')

print(f'International Spanish Form: {International_Spanish}')

Input:

3/5

Output:

US English Form: March 5

International Spanish Form: 5 Marzo

Explanation:

You start by taking input from the user then splitting that at the '/' so that we have the date and the month in separate variables. Then we have an if statement checking to see what month is given and when the month is detected it sets a Spanish variable and an English variable then prints it to the screen.

Hope this helps.

7 0
2 years ago
Cyber security class i need help​
makkiz [27]

Answer:

Explanation:

yooooo it b

5 0
2 years ago
When writing potential test questions, it is very important to use vocabulary words in their correct form. Please select the bes
Ilya [14]
The answer is True.

Hope I helped!
6 0
3 years ago
Read 2 more answers
Gettier contributed to what we know about the __________ model, while Rosch contributed to what we know about the __________ mod
svet-max [94.6K]

Gettier contributed to what we know about the exemplar model, while Rosch contributed to what we know about the prototype model. Prototype and exemplar theories are both versions of statistical theories of concepts. Prototype theories hold that concepts represent categories by means of a summary of the typical properties that category members possess, while exemplar theories hold that concepts represent categories by means of a cluster of individual category members that may be used to extract the statistical central tendency of the category.

6 0
3 years ago
Read 2 more answers
Other questions:
  • 8) Which of the following statements is FALSE?
    14·1 answer
  • Apart from confidential information, what other information does NDA help to outline?
    15·1 answer
  • ____ is a practice where a user in enticed by possible rewards and then asked to provide personal information.
    14·1 answer
  • 1.
    12·1 answer
  • What is a correlation and how does it relate to inferential error?
    5·1 answer
  • Privacy settings allow account owners to decide who can ........
    12·2 answers
  • Name the different type of vegetation found in India ?​
    8·2 answers
  • How do i move a file in python3
    10·1 answer
  • Which will you see on the next line 9, 2, 3.5, 7]
    9·2 answers
  • give the difference between functional and functional tools in the middle of to the circle give importance​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!