1 answer

THE FOLLOWING PROGRAM IS NEEDED IN JAVA LANGUAGE Design a class torepresent account, include the following...

Question:

THE FOLLOWING PROGRAM IS NEEDED IN JAVA LANGUAGE

Design a class torepresent account, include the following members: -Data Members a)Name of depositor-Stringb)Account Number –intc)Type of account –Boolean d)Balance amount -doublee)AnnualInterestrate -double Methods: -(a)To assign initial values (use constructor)(b)To deposit an amount.(c)TO withdraw amount with the restriction the minimum balance is 50 rs. Ifyouwithdraw amount reduced the balance below 50 then print the error message.(d)Display the name and balance of the account.(e)Get_Monthly_intrestRate() -Return the monthly interestrate whichis nothing but Annualintrestrate/12. Annualinterestrate is in percentage e.g 4.5%(f)Get_Monthly_intrest:-return themonthly interest, it is calculated as balance * Get_Monthly_intrestRate()

________________________________________________________________________________________________________________________________

Write a program simple prints “Wonder of the objects” inside the main method. Without using any print statement or concrete methods or dot operators inside the main methods.

_________________________________________________________________________________________________________________________________

Create a class name stock that contains:-1)A String data field name symbol for the stock_ symbol.2)A string data field name of company3)A double data field name previousCloseingPrice that store the stock price for previous day4)A double data field name currentPrice that store the stock price for the current time5)A method getChangepercent() that return the percentage changed in previousCloseingPrice and currentPrice.e.gstock Symbol is ORCL and stock name = Oracle Carporation , the previousCloseingPrice=34.5 and current change price is 34.35 and display the price change percentage.

_____________________________________________________________________________________________________________________________________

Design a class FAN to represent fan . The class contains:-a.Three constants named Slow, Medium and FAST with the values 1,2 and 3 to denote the FAN Speed.b.A private intdata field named speed that specifies the speed of the fan (Default is Slow)c.A private Boolean data field named ‘on’ that specifies whether the fan is on ( the default is false)d.A private double data field named radius that specifies the radius of the fan )default is 5)e.A string data field named colorthat specifies the colorof the fan (the default is blue)f.Define default constructor g.Method tostring() that returns a string description for the fan. If the Fan is on the method returns the fan speed, color, and radiusin one combined string. If fan is not on the method returns the fan colorand radiusalong with the string “fan is off” in one combined string.h.WAP to creates two FAN objects. Assign maximumspeed, radius 10 , color Yellow and turn it on to the first Object . Assign medium speed,radius 5 , color blue and turn it off to the second objects. Display the object by invoking to string method.


Answers

Program code to copy

Fan.java

Fan.java  public class Fan {         public static final int SLOW=1,MEDIUM=2,FAST=3; // static final attributes with constant values         private int speed;         private boolean f_on;         private double radius;         private String color;                  Fan()     {         speed=SLOW;         f_on=false;         radius=5;         color="blue";     }           Fan(int speed,double radius,String color,boolean f_on) //Constructor to store values         {                 this.speed=speed;                 this.radius=radius;                 this.color=color;                 this.f_on=f_on;         }           public void tostring() // toString method used to return String data of Fan         {                 if(f_on==true) // Checking Whether Fan is on/off                 {                         System.out.println("Fan is on \n the speed is ="+speed+"\n the color is ="+color+"\n the radius is ="+radius);                 }                 else                 {                         System.out.println("Fan is off \n the color of fan is ="+color+"\n the radius of fan is ="+radius);                 }         }                   public static void main(String[] args)                 {                         Fan obj1 = new Fan(FAST,10,"yellow",true);                         Fan obj2 = new Fan(MEDIUM,5,"blue",false);                         obj1.tostring();                         obj2.tostring();                 } }

Sample output

EL Problems @ Javadoc Declaration Console X <terminated> Fan [Java Application] C:\Program Files\Java\jre1.8.0_201\bin\javaw.

BankAccount.java

BankAccount.java  import java.io.*; import java.util.*; class Bank  {         private String nameOfDepositor;         private int accNum;         private boolean accType;         private double bal, AnnualInterestrate;         void set(String n,int num,boolean acc,double B, double rate)          {                 nameOfDepositor=n;accNum=num;accType=acc;bal=B;AnnualInterestrate=rate;         }         void deposit(double d)          {                  bal+=d;          }         void withdraw(double w)          {                 if(bal>=w && bal-w>50)                         bal-=w;                 else                         System.out.println("Insufficient Balance in your account");         }         void disp()          {                 System.out.println("Name of account Holder is :"+nameOfDepositor);                 System.out.println("Current Balance in your Savings Bank account is :"+bal );                          }         double Get_Monthly_interestRate()     {         AnnualInterestrate=((0.01*AnnualInterestrate)/12);         return AnnualInterestrate;     }     void Get_Monthly_interest()     {                  System.out.println("Monthly Interest for the available account balance is Rs. "+bal*Get_Monthly_interestRate());     } }          public class BankAccount  {         public static void main(String[] args) throws IOException          {                 BufferedReader in = new BufferedReader(new InputStreamReader(System.in));                 Scanner sc=new Scanner(System.in);                 System.out.println("\n*******************WELCOME TO JAVA BANK********************");                 System.out.print("Please enter your name :");                 String s=in.readLine();                 System.out.print("\nPlease enter your account number :");                 int no=Integer.parseInt(in.readLine());                 System.out.print("\nDo you have Savings Account at our branch?");                 boolean ss=sc.nextBoolean();                 if(ss==true)                 {             System.out.println("You can proceed.... ;) ");                 }                 else                 {             sc.close();                 }                 System.out.print("\nEnter balance of your account: ");                 double bl=Double.parseDouble(in.readLine());                 System.out.println("Enter Annual Interest Rate in Percentage: ");                 double r=sc.nextDouble();                          Bank ob=new Bank();                 ob.set(s,no,ss,bl,r);                 ob.disp();                 System.out.print(" YOU WANT TO WITHDRAW MONEY(Y/N) : ");                 String w=in.readLine();                 if(w.equalsIgnoreCase("y"))                 {                         System.out.print("\nEnter amount : ");                         double amnt=Double.parseDouble(in.readLine());                         ob.withdraw(amnt);                         ob.disp();                         ob.Get_Monthly_interest();                         System.out.println("*******************THANKS FOR USING JAVA BANK*****************");                         System.exit(0);                 }         } }

sample output

Problems @ Javadoc Declaration Console X <terminated> BankAccount [Java Application] C:\Program FilesVava\jre1.8.0_201\bin\ja

stock_Q6.java

stock_Q6.java   class Stock  {      private String symbol;     private String name;      private double previousClosingPrice;     private double currentPrice;      public Stock(String symbol, String name)          {         this.symbol = symbol;         this.name = name;     }      public String getSymbol()          {         return symbol;     }      public void setSymbol(String symbol)          {         this.symbol = symbol;     }      public String getName()          {         return name;     }      public void setName(String name)          {         this.name = name;     }      public double getCurrentPrice()          {         return currentPrice;     }      public void setCurrentPrice(double currentPrice)          {         this.previousClosingPrice = this.currentPrice;         this.currentPrice = currentPrice;     }      public double getPreviousClosingPrice()          {         return previousClosingPrice;     }      public void setPreviousClosingPrice(double previousClosingPrice)          {         this.previousClosingPrice = previousClosingPrice;     }      public double getChangePercent()          {         return (((currentPrice - previousClosingPrice) / previousClosingPrice)*100);     } }  public class stock_Q6  {      public static void main(String[] args)          {          Stock stock1 = new Stock("ORCL", "Oracle Corporation");         stock1.setCurrentPrice(34.5);         stock1.setCurrentPrice(34.35);         System.out.println("Stock Name: " + stock1.getName() + " Symbol: " + stock1.getSymbol());         System.out.println("Previous Price: " + stock1.getPreviousClosingPrice());         System.out.println("Current Price: " + stock1.getCurrentPrice());         System.out.println("Percentage Changed: " + stock1.getChangePercent()); //Increase or Decrease in percentage as per the previous price and current price      } }

sample output

Problems @ Javadoc Declaration Console X <terminated stock_06 [Java Application] C:\Program Files\Javajrel.8.0_201\bin\javaw.

.

Similar Solved Questions

1 answer
(2) Consider two firms: ABC: an all equity firm. It has 9 million common shares outstanding,...
(2) Consider two firms: ABC: an all equity firm. It has 9 million common shares outstanding, worth $40/share. XYZ: is a levered firm with 4.6 million shares at $52.50/share. Its perpetual debt has a market value of $91 million and costs 8% a year. They are identical in every other way. Both firms e...
1 answer
Using instruments sketch or draw the two given views and a partial auxiliary view of the...
Using instruments sketch or draw the two given views and a partial auxiliary view of the inclined surfaces. 1) what is partially view ? I'm not given any extra information rather than that. It is a book question. 2) Can i draw on blank paper drawing by using solid works ? It can be done in soli...
1 answer
1B-8. LEAH Inc. purchases a parcel of land for $100,000. Sometime later a freeway is built...
1B-8. LEAH Inc. purchases a parcel of land for $100,000. Sometime later a freeway is built near the property. According to many experts the freeway increases the value of the land to $7,000,000. Required: 1. What would be the value of LEAH's property according to an accountant using US GAAP? 2. ...
1 answer
CASE STUDY Answer the following questions 1. What information would you report and record? Mr. Juan...
CASE STUDY Answer the following questions 1. What information would you report and record? Mr. Juan Gomez is a 75-year-old resident of Valley View Nursing Center. You have been assigned his care this morning. Mr. Gomez told you that he had a bowel movement at 0500 (5:00 AM) You helped Mr. Gomez get ...
1 answer
In earlier days, horses pulled barges down canals in the manner shown below. Suppose that the...
In earlier days, horses pulled barges down canals in the manner shown below. Suppose that the horse pulls on the rope with a force of 7900 N at an angle of 18° to the direction of motion of the barge, which is headed straight along the positive direction of an x axis. The mass of the barge is 91...
2 answers
Question 15 (5 points) Translate the following sentence into an equation. Twice a number m minus...
Question 15 (5 points) Translate the following sentence into an equation. Twice a number m minus three equals the sum of m and five. a) 2m-3 = m +5 Ob) 2m - 3 = 5m c) 2(m - 3) = 5m d) 2(m - 3) = m + 5...
1 answer
A) 10,320 B) 770 C) 11,100 D) 8,750 Required information The year-end financial statements of Grunewald...
A) 10,320 B) 770 C) 11,100 D) 8,750 Required information The year-end financial statements of Grunewald Company contained the following elements and corresponding amounts. Assets = $22,150; Common Stock = $5,000; Revenue = $11,090; Dividends = $770; Beginning Retained Earnings = $3,750; Ending Retai...
1 answer
Why might a Latina Mother whose child has a high fever from a cold resist nurse...
Why might a Latina Mother whose child has a high fever from a cold resist nurse advise to place a cold compress on the child's head? Describe a culturally appropriate way to convince the mother to comply with that suggestions. give big paragraph in APA format :)...
1 answer
Question 3 10 pts Mary Smith took a car loan of $23,000 to pay back in...
Question 3 10 pts Mary Smith took a car loan of $23,000 to pay back in 72 monthly installments at an interest rate of 18%. Compute the loan balance immediately after the 48th payment. 0 $10,508 O $12,844 0 $12,590 O $11,500...
1 answer
What are the strengths and weaknesses of Nigeria's economy
What are the strengths and weaknesses of Nigeria's economy?(it only says how the economoy improved and developed in the CIA website)...
1 answer
5. Of the three monetary policy tools mentioned in the text, which one does not change...
5. Of the three monetary policy tools mentioned in the text, which one does not change the cost of borrowing reserves for commercial banks? 6. What is the relationship between risk and the size of an insurance premium? Why is this relationship "fair" or "logical”? 7. What backs the...
1 answer
Video # 3 How Doctors Tell Patients They’re Dying/Being Mortal Mortality is part of life but...
Video # 3 How Doctors Tell Patients They’re Dying/Being Mortal Mortality is part of life but is difficult to face, no matter what the situation is surrounding it. Whether the patient has been battling with a disease for a long time, or a short time. Provide a minimum of a two paragraph respons...
1 answer
Which of the following are true of both Robert Smithson’s Spiral Jetty and Serpent Mound made...
Which of the following are true of both Robert Smithson’s Spiral Jetty and Serpent Mound made by Native Americans? A. They both use analytic line   B. they both incorporate spirals, in fact, Smithson, inspired by the spirals of Serpent Mound, made his Jetty in a spiral C. both ...
1 answer
Lane Company manufactures a single product and applies overhead cost to that product using standard direct...
Lane Company manufactures a single product and applies overhead cost to that product using standard direct labor-hours. The budgeted variable manufacturing overhead is $2.80 per direct labor-hour and the budgeted fixed manufacturing overhead is $612,000 per year. The standard quantity of materials ...
1 answer
Closing Entries After the accounts have been adjusted at April 30, the end of the fiscal...
Closing Entries After the accounts have been adjusted at April 30, the end of the fiscal year, the following balances were taken from the ledger of Nuclear Landscaping Co.: Felix Godwin, Capital $685,260 Felix Godwin, Drawing 39,000 Fees Earned 558,000 Wages Expense 423,000 Rent Expense 1...
1 answer
Ch.12 Discussion topic: Internal Control Deficiency: Frank James, a highly competent employee of Brinkwater Sales Corporation,...
Ch.12 Discussion topic: Internal Control Deficiency: Frank James, a highly competent employee of Brinkwater Sales Corporation, had been responsible for accounting-related matters for two decades. His devotion to the firm and his duties had always been exceptional, and over the years, he had been giv...
1 answer
Use DeMoivre's Theorem to find the indicated power of the complex number. Write the result in...
Use DeMoivre's Theorem to find the indicated power of the complex number. Write the result in standard form. (Round terms to four decimal places.) [2(cos 10° + i sin 109)...