answer.
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
nikitadnepr [17]
2 years ago
14

Create an abstract Division class with fields for a company's division name and account number, and an abstract display() method

that will be defined in the subclasses. Use a constructor in the superclass that requires values for both fields. Create two subclasses named InternationalDivision and DomesticDivision. The InternationalDivision class includes a field for the country in which the division is located, a field for the language spoken, and a constructor that requires all fields when created. The DomesticDivision class include a field for the state in which the division is located and a constructor that requires all fields when created. Write an application named UseDivision that creates two instances of each of these concrete classes.
Computers and Technology
1 answer:
Paha777 [63]2 years ago
8 0

Answer:

// SAVE IN Division.java

public abstract class Division

{

protected String name;

protected String account_number;

public Division(String nam,String ac)

{

name = nam;

account_number = ac;

}

public abstract void display();

}

// END OF Division.java

// SAVE IN InternationalDivision.java

public class InternationalDivision extends Division

{

private String country;

private String language;

public InternationalDivision(String nam, String ac,String country,String lan)

{

super(nam,ac);

this.country = country;

this.language = lan;

}

public void display()

{

System.out.println( " name of company is " + name);

System.out.println( " Account number of company is " + account_number);

System.out.println( " company located in " + country);

System.out.println( " people in that company speak " + language);

}

}

// END OF InternationalDivision.java

// SAVE IN DomesticDivision.java

public class DomesticDivision extends Division

{

private String state;

public DomesticDivision(String nam, String ac,String sta)

{

super(nam,ac);

state = sta;

}

public void display()

{

System.out.println( " name of company is " + name);

System.out.println( " Account number of company is " + account_number);

System.out.println( " company located in the state " + state);

}

}

// END OF DomesticDivision.java

// SAVE IN UseDivision.java

public class UseDivision

{

public static void main(String[] args)

{

InternationalDivision ID1 = new InternationalDivision("Hero","11223344","China","Chinesse");

ID1.display();

System.out.println();

InternationalDivision ID2 = new InternationalDivision("Honda","1122334455","Singapore","Tamil");

ID2.display();

System.out.println();

DomesticDivision DD1 = new DomesticDivision("Ford","77223344","Arizona");

DD1.display();

System.out.println();

DomesticDivision DD2 = new DomesticDivision("Maruti","6188994455","Alaska");

DD2.display();

}

}

// END OF UseDivision.java

You might be interested in
Int side1;
o-na [289]

Answer:

int width_A, width_B, len_A, len_B;

float rw, rl;

rw = (float)(width_A/width_B);

rl = (float)(len_A/len_B);

if(rw == rl)

printf("They are similar");

else

printf("They are not similar");

Explanation:

The width of the first triangle i call width_A.

The width of the second triangle i call width_B.

The length of the first triangle i call len_A.

The length of the second triangle i call len_B.

The ratio of the width i call rw.

The ratio of the length i call rl.

If rw=rl, the retangles are similar. Otherwise, they are not.

The code is:

int width_A, width_B, len_A, len_B;

float rw, rl;

rw = (float)(width_A/width_B);

rl = (float)(len_A/len_B);

if(rw == rl)

printf("They are similar");

else

printf("They are not similar");

8 0
2 years ago
Which command backs up the single database called 'websites' to the file 'websites_backup.sql'?
kaheart [24]

Answer:

(d) mysqldump websites -u root -p > websites_backup.sql

Explanation:

To create a backup mysqldump is used.It is a data backup program.This program was originally written by Igor Romanenko. It creates a backup of file name websites_backup.sql.

So among the given options in the question option d is the correct option which backs up the single database websites in the file website_backup.sql.

8 0
2 years ago
In Section 8.5.4, we described a situation in which we prevent deadlock by ensuring that all locks are acquired in a certain ord
ruslelena [56]

Answer:

See Explaination

Explanation:

Separating this critical section into two sections:

void transaction(Account from, Account to, double amount)

{

Semaphore lock1, lock2;

lock1 = getLock(from);

lock2 = getLock(to);

wait(lock1);

withdraw(from, amount);

signal(lock1);

wait(lock2);

deposit(to, amount);

signal(lock2);

}

will be the best solution in the real world, because separating this critical section doesn't lead to any unwanted state between them (that is, there will never be a situation, where there is more money withdrawn, than it is possible).

The simple solution to leave the critical section in one piece, is to ensure that lock order is the same in all transactions. In this case you can sort the locks and choose the smaller one for locking first.

4 0
2 years ago
Define a class named ComparableSquare that extends Square (defined above) and implements Comparable. Implement the compareTo met
Alexxx [7]

Answer:

/*********************************************************************************

* (The ComparableCircle class) Define a class named ComparableCircle that        *

* extends Circle and implements Comparable. Draw the UML diagram and implement   *

* the compareTo method to compare the circles on the basis of area. Write a test *

* class to find the larger of two instances of ComparableCircle objects.         *

*********************************************************************************/

public class Exercise_13_06 {

/** Main method */

public static void main(String[] args) {

 // Create two instances of ComparableCircle objects

 ComparableCircle comparableCircle1 = new ComparableCircle(12.5);

 ComparableCircle comparableCircle2 = new ComparableCircle(18.3);

 // Display comparableCircles

 System.out.println("\nComparableCircle1:");

 System.out.println(comparableCircle1);

 System.out.println("\nComparableCircle2:");

 System.out.println(comparableCircle2);

 // Find and display the larger of the two ComparableCircle objects

 System.out.println((comparableCircle1.compareTo(comparableCircle2) == 1  

  ? "\nComparableCircle1 " : "\nComparableCircle2 ") +  

  "is the larger of the two Circles");

}

}

3 0
2 years ago
Cha’relle works as an editor at a publishing house. She got her position after interviewing another editor and following that ed
yuradex [85]

She used her communication skills meaning the verbal method.

Explanation:

Because she has a natural ability to talk and communicate well with others, offering them insight on any issues they may have or anything they may be lacking or struggling with. She's a natural born healer and giver.

4 0
2 years ago
Other questions:
  • Which one of the following characteristics or skills of a ScrumMaster are closelyaligned with coaching?Select one:
    5·1 answer
  • Write a java program that will print out the following pattern 1 12 123 1234 12345
    14·1 answer
  • Assign courseStudent's name with Smith, age with 20, and ID with 9999. Use the printAll() member method and a separate println()
    5·1 answer
  • The computer component that makes sure that instructions are decoded and executed properly is the ___________.
    11·2 answers
  • Assume that the population of Mexico is 128 million and that the population increases 1.01 percent annually. Assume that the pop
    7·1 answer
  • Given is the array prices with 100 elements(prices[100]). The problem consists of two parts: 1. Find the highest price in the ar
    11·1 answer
  • Of these two types of programs:a. I/O -bound b. CPU -bound which is more likely to have voluntary context switches, and which is
    6·1 answer
  • Connie works for a medium-sized manufacturing firm. She keeps the operating systems up-to-date, ensures that memory and disk sto
    7·1 answer
  • A government agency is getting rid of older workstations. The agency will donate these workstations, along with other excess com
    6·1 answer
  • Spark is electrical discharge in air, while air is mix of variety of gases what particles conduct electricity in gas
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!