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
Anarel [89]
3 years ago
9

Create a class BankAccount with 2 variables, a int balance, and a string name. Then create an instance of the BankAccount Class,

change its name and balance, and print its name and balance.
Computers and Technology
1 answer:
almond37 [142]3 years ago
6 0

Answer:

Follows are the code to the given question:

class BankAccount //defining a class BankAccount

{

 int balance;//defining integer variable balance  

 String name;//defining String variable name

 BankAccount()//defining default constructor

 {

 }

  BankAccount(int balance, String name)//defining parameterized constructor that accepts two parameters  

  {

     this.balance = balance;//use this to hold parameter value

     this.name = name;//use this to hold parameter value

  }

}

public class Main//defining Main class

{

 public static void main(String[] asr)//main method  

 {

  BankAccount obv = new BankAccount(1969, "Mustang");//creating class object and pass value in parameter

   System.out.println("Your name is: " + obv.name + " and " +"Your balance is: "+ obv.balance);//print value with message

 }

}

Output:

Your name is: Mustang and Your balance is: 1969

Explanation:

In this code a class "BankAccount" is declared, that  defines the two variable "name and balance" as a integer and string, and in the next step a parameterized constructor is declared, that uses this keyword to hold value.

In the main class the main method is declared and inside the method class object is created that accepts parameter value and use the print method to print its value.

You might be interested in
Which of the following correctly shows the general structure of a for-each loop header?for (initialization; condition; increment
ladessa [460]

Answer:

for (type variable-name : array-or-collection)-On each iteration the next element can be accessed using the specified variable.

Explanation:

the general structure of a for-each loop header is represented as :

for (type variable-name : array-or-collection) - On each iteration the next element can be accessed using the specified variable.

In other words it can be represented as:

for (type variable-name : array-or-collection)

{  

   //On each iteration the variable-name will contain the next value in the array or collection and this value can be referenced in the loop body using the variable-name.

}

6 0
4 years ago
PT8 what does the word " fossil " mean
Eduardwww [97]

Answer:

A fossil is any preserved remains, impression, or trace of any once-living thing from a past geological age. Examples include bones, shells, exoskeletons, stone imprints of animals or microbes, objects preserved in amber, hair, petrified wood, oil, coal, and DNA remnants

Explanation:

thanks

3 0
3 years ago
Read 2 more answers
Solve the equation.<br>| 11 X 12362​
sergey [27]

Answer:

135982

Explanation:

Its simple math

4 0
3 years ago
Which of the below statements describes the nature of HTML elements - check as many as apply
slava [35]

Answer:

The answer to this question is option 1,2 and 4.

Explanation:

Some html elements does not contain anything or having no content are called empty html elements.for ex:- <br>,<hr> etc.

HTML elements are of two types block and inline.block elements starts with new line for ex:-div,body etc.Inline elements does not starts with new line.for ex:-<style>,<meta>,<head>etc.

Html elements also contains attributes that modify the element for ex:-

<body style="background-color:blue;">

where style is an attribute.

5 0
3 years ago
_______medium is a secondary storage medium that uses magnetic techniques to store and retrieve data on disks or tapes coated wi
KiRa [710]

Answer:

The answer is Magnetic

Explanation:

Magnetic medium is a secondary storage medium that uses magnetic techniques to store and retrieve data on disks or tapes coated with magnetically sensitive materials.

Magnetic based drives, for example:- Hard disk. Floppy Disk. Magnetic tape.

Optical based drives, for example:- CD drive (ROM and RW) DVD drive (RPM and RW)

Flash or solid state chip based drives, for example:- USB drive. SD cards.

7 0
3 years ago
Other questions:
  • ​What file system below does not support encryption, file based compression, and disk quotas, but does support extremely large v
    10·1 answer
  • Which of the following keys on a keyboard allows you to select multiple cells located in different parts of your worksheet?
    13·2 answers
  • 20 PTS URGENT!!! Derek’s organization uses an emerging technology that uses specialized software to place an image on an object,
    6·2 answers
  • "what type of index has an index key value that points to a data row, which contains the key value? "
    9·1 answer
  • What is the correct term for a set of established guidelines for actions (which may be designated by individuals, teams, functio
    13·1 answer
  • Which statement best describes a transition in PowerPoint?
    12·1 answer
  • Technology has proliferated in Kenya and Somaliland, with text messages used to replace cash, creating mobile money use that, on
    11·1 answer
  • 1. What runs horizontally and is identified with numbers?
    12·2 answers
  • Which of the following describes an executive information system (EIS)?
    11·1 answer
  • What social media profession entails determining how and in what way an organization will create and maintain a social media pre
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!