Question: in Java Grateful Code: import java.util.Scanner; class financial{ int EnterInfo(){ Scanner my_asset = new Scanner(System.in); System.out.println(Enter Bank Account Balance: ); int asset = my_asset.nextInt(); return
in Java
Grateful Code:
import java.util.Scanner;
class financial{
int EnterInfo(){
Scanner my_asset = new Scanner(System.in);
System.out.println("Enter Bank Account Balance: ");
int asset = my_asset.nextInt();
return asset;
}
void Grateful(int asset){
String Statement = "I have: " + asset + " worth of assets available to me.";
String Statement2= "I am grateful for my: " + asset + " asset worth.";
System.out.println(Statement);System.out.println(Statement2);
}
}
class Car extends financial{
int EnterInfo(){
Scanner my_asset = new Scanner(System.in);
System.out.println("Enter Blue Book Value: ");
int asset = my_asset.nextInt();
return asset;
}
}
class Clothing extends financial{
int EnterInfo(){
Scanner my_asset = new Scanner(System.in);
System.out.println("Enter Clothing Value: ");
int asset = my_asset.nextInt();
return asset;
}
}
class Knowledge{
boolean loop = true;
String tech = "";
void EnterMyTech(){
while (loop){
Scanner my_tech = new Scanner(System.in);
System.out.println("Enter available technology: Type 'exit' when done: ");
String tech1 = my_tech.nextLine();
tech += " " + tech1;
System.out.println("My tech: " + tech);
if (tech1.contains("exit")){
loop = false;
}
}
}
}
class assets{
public static void main(String[] args){
Scanner AssetClass = new Scanner(System.in);
System.out.println("Select Asset: [bank/car/cloth/tech] ");
String myasset = AssetClass.nextLine();
if (myasset.equals("car")){
financial f_car = new Car();
int b_book = f_car.EnterInfo();
f_car.Grateful(b_book);
System.out.println("VROOM!!!!");
}
else if (myasset.equals("cloth")){
financial f_clothes = new Clothing();
int myClothes = f_clothes.EnterInfo();
f_clothes.Grateful(myClothes);
System.out.println("Some people in this world have no clothing.");
}
else if (myasset.equals("tech")){
Knowledge my_tech = new Knowledge();
my_tech.EnterMyTech();
System.out.println("With Google, your knowledge is LIMITLESS.");
} else{
financial f = new financial();
int bank_balance = f.EnterInfo();
f.Grateful(bank_balance);
}
}
}
Adjust the 'grateful' code to your personal assets.
Compile and run the code, and then copy/paste images to a Word document or do a media recording.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
