SlideShare a Scribd company logo
1 of 4
Nama : Muhammad Tohir
Nim : 201181102
Seksi :01
Tugas 03
Account
import java.util.Scanner;
public class Account
{
public double Balance;
public Account(double initialBalance)
{
if (initialBalance > 0.0)
Balance = initialBalance;
Scanner input = new Scanner(System.in);
}
public void credit (double Amount)
{
Balance = Balance + Amount;
}
public double getBalance()
{
return Balance;
}
}
Accounttest
import java.util.Scanner;
public class accounttest
{
public static void main (String[]args)
{
Account account1 = new Account(50.00);
Account account2 = new Account(-7.53);
System.out.printf("Account1 balance :$%.2fnn",account1.getBalance());
System.out.printf("Account2 balance :$%.2fnn",account2.getBalance());
Scanner input = new Scanner(System.in);
double depositAmount;
System.out.print("Enter deposit amount for account1:" );
depositAmount = input.nextDouble();
System.out.printf("nadding %.2f to account1 blance nn",depositAmount);
account1.credit(depositAmount);
System.out.printf("account1 blance : $%.2fn",account1.getBalance());
System.out.printf("account2 blance : $%.2fn",account2.getBalance());
System.out.printf("Enter deposit account for account2: ");
depositAmount =input.nextDouble();
System.out.printf("nadding %.2f to account2 balancenn",
depositAmount);
account2.credit(depositAmount);
System.out.printf("account1 balance: $%.2fn",account1.getBalance());
System.out.printf("account2 balance : $%.2fn",aaccount2.getBalance());
}
}
Tmpj3 01 201181102muhammad_tohir

More Related Content

What's hot

cats.effect.IO - Scala Vienna Meetup February 2019
cats.effect.IO - Scala Vienna Meetup February 2019cats.effect.IO - Scala Vienna Meetup February 2019
cats.effect.IO - Scala Vienna Meetup February 2019Daniel Pfeiffer
 
WAP to find out whether the number is prime or not in java
WAP to find out whether the number is prime or not in javaWAP to find out whether the number is prime or not in java
WAP to find out whether the number is prime or not in javaOne97 Communications Limited
 
Latihan visual basic 2010/Looping/Perulangan
Latihan visual basic 2010/Looping/PerulanganLatihan visual basic 2010/Looping/Perulangan
Latihan visual basic 2010/Looping/PerulanganNurul Arhaiyyu
 
Top 3 SWT Exceptions
Top 3 SWT ExceptionsTop 3 SWT Exceptions
Top 3 SWT ExceptionsLakshmi Priya
 
Dr Jammi Ashok - Introduction to Java Material (OOPs)
 Dr Jammi Ashok - Introduction to Java Material (OOPs) Dr Jammi Ashok - Introduction to Java Material (OOPs)
Dr Jammi Ashok - Introduction to Java Material (OOPs)jammiashok123
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intentPERKYTORIALS
 
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAMPROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAMSaraswathiRamalingam
 

What's hot (10)

cats.effect.IO - Scala Vienna Meetup February 2019
cats.effect.IO - Scala Vienna Meetup February 2019cats.effect.IO - Scala Vienna Meetup February 2019
cats.effect.IO - Scala Vienna Meetup February 2019
 
WAP to find out whether the number is prime or not in java
WAP to find out whether the number is prime or not in javaWAP to find out whether the number is prime or not in java
WAP to find out whether the number is prime or not in java
 
Vp4
Vp4Vp4
Vp4
 
Latihan visual basic 2010/Looping/Perulangan
Latihan visual basic 2010/Looping/PerulanganLatihan visual basic 2010/Looping/Perulangan
Latihan visual basic 2010/Looping/Perulangan
 
Top 3 SWT Exceptions
Top 3 SWT ExceptionsTop 3 SWT Exceptions
Top 3 SWT Exceptions
 
Dr Jammi Ashok - Introduction to Java Material (OOPs)
 Dr Jammi Ashok - Introduction to Java Material (OOPs) Dr Jammi Ashok - Introduction to Java Material (OOPs)
Dr Jammi Ashok - Introduction to Java Material (OOPs)
 
5 Rmi Print
5  Rmi Print5  Rmi Print
5 Rmi Print
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intent
 
C#
C#C#
C#
 
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAMPROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
 

Viewers also liked

Tugas latihan java tohir 1
Tugas latihan java tohir 1Tugas latihan java tohir 1
Tugas latihan java tohir 1pencari buku
 
Persiapan UN by MGMP Fisika BPK PENABUR
Persiapan UN by MGMP Fisika BPK PENABURPersiapan UN by MGMP Fisika BPK PENABUR
Persiapan UN by MGMP Fisika BPK PENABURguest4f71ffe
 
Soal dan pembahasan tukpd ii tahun 2013
Soal dan pembahasan tukpd ii tahun 2013Soal dan pembahasan tukpd ii tahun 2013
Soal dan pembahasan tukpd ii tahun 2013Ema Rachmawati
 
Soal kompetisi ipa kls ix
Soal kompetisi ipa kls ixSoal kompetisi ipa kls ix
Soal kompetisi ipa kls ixEma Rachmawati
 
Kompetisi ipa kelas ix smp 2013 tingkat kecamatan
Kompetisi ipa kelas ix  smp 2013 tingkat kecamatan Kompetisi ipa kelas ix  smp 2013 tingkat kecamatan
Kompetisi ipa kelas ix smp 2013 tingkat kecamatan Ema Rachmawati
 
Kompetisi ipa kelas viii smp 2013 tingkat kecamatan
Kompetisi ipa kelas viii  smp 2013 tingkat kecamatan Kompetisi ipa kelas viii  smp 2013 tingkat kecamatan
Kompetisi ipa kelas viii smp 2013 tingkat kecamatan Ema Rachmawati
 
Soal kompetisi ipa tingkat kecamatan 2009 2010
Soal kompetisi ipa tingkat kecamatan 2009   2010Soal kompetisi ipa tingkat kecamatan 2009   2010
Soal kompetisi ipa tingkat kecamatan 2009 2010Ema Rachmawati
 
Bab 6 Bioteknologi kelas 9G SMPN 264 Jakarta
Bab 6 Bioteknologi kelas 9G SMPN 264 JakartaBab 6 Bioteknologi kelas 9G SMPN 264 Jakarta
Bab 6 Bioteknologi kelas 9G SMPN 264 JakartaLiana Susanti SMPN 248
 
Soal tryout KLS IX (IPA FISIKA)
Soal tryout KLS IX (IPA FISIKA)Soal tryout KLS IX (IPA FISIKA)
Soal tryout KLS IX (IPA FISIKA)Fitri Immawati
 

Viewers also liked (11)

Tugas latihan java tohir 1
Tugas latihan java tohir 1Tugas latihan java tohir 1
Tugas latihan java tohir 1
 
Persiapan UN by MGMP Fisika BPK PENABUR
Persiapan UN by MGMP Fisika BPK PENABURPersiapan UN by MGMP Fisika BPK PENABUR
Persiapan UN by MGMP Fisika BPK PENABUR
 
Soal dan pembahasan tukpd ii tahun 2013
Soal dan pembahasan tukpd ii tahun 2013Soal dan pembahasan tukpd ii tahun 2013
Soal dan pembahasan tukpd ii tahun 2013
 
Virus dan Antivirus
Virus dan AntivirusVirus dan Antivirus
Virus dan Antivirus
 
Soal kompetisi ipa kls ix
Soal kompetisi ipa kls ixSoal kompetisi ipa kls ix
Soal kompetisi ipa kls ix
 
Kompetisi ipa kelas ix smp 2013 tingkat kecamatan
Kompetisi ipa kelas ix  smp 2013 tingkat kecamatan Kompetisi ipa kelas ix  smp 2013 tingkat kecamatan
Kompetisi ipa kelas ix smp 2013 tingkat kecamatan
 
Kompetisi ipa kelas viii smp 2013 tingkat kecamatan
Kompetisi ipa kelas viii  smp 2013 tingkat kecamatan Kompetisi ipa kelas viii  smp 2013 tingkat kecamatan
Kompetisi ipa kelas viii smp 2013 tingkat kecamatan
 
Rumus gerak lurus
Rumus gerak lurusRumus gerak lurus
Rumus gerak lurus
 
Soal kompetisi ipa tingkat kecamatan 2009 2010
Soal kompetisi ipa tingkat kecamatan 2009   2010Soal kompetisi ipa tingkat kecamatan 2009   2010
Soal kompetisi ipa tingkat kecamatan 2009 2010
 
Bab 6 Bioteknologi kelas 9G SMPN 264 Jakarta
Bab 6 Bioteknologi kelas 9G SMPN 264 JakartaBab 6 Bioteknologi kelas 9G SMPN 264 Jakarta
Bab 6 Bioteknologi kelas 9G SMPN 264 Jakarta
 
Soal tryout KLS IX (IPA FISIKA)
Soal tryout KLS IX (IPA FISIKA)Soal tryout KLS IX (IPA FISIKA)
Soal tryout KLS IX (IPA FISIKA)
 

Similar to Tmpj3 01 201181102muhammad_tohir

Java programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdfJava programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdffathimafancy
 
Bank Program in JavaBelow is my code(havent finished, but it be .pdf
Bank Program in JavaBelow is my code(havent finished, but it be .pdfBank Program in JavaBelow is my code(havent finished, but it be .pdf
Bank Program in JavaBelow is my code(havent finished, but it be .pdfizabellejaeden956
 
IP project for class 12 cbse
IP project for class 12 cbseIP project for class 12 cbse
IP project for class 12 cbsesiddharthjha34
 
I need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdfI need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdfrajeshjangid1865
 
You are not setting any values for those variables(name, ID, interes.pdf
You are not setting any values for those variables(name, ID, interes.pdfYou are not setting any values for those variables(name, ID, interes.pdf
You are not setting any values for those variables(name, ID, interes.pdfdeepakangel
 
Automatically Repairing Test Cases for Evolving Method Declarations
Automatically Repairing Test Cases for Evolving Method DeclarationsAutomatically Repairing Test Cases for Evolving Method Declarations
Automatically Repairing Test Cases for Evolving Method DeclarationsICSM 2010
 
public class InsufficientFundsException extends Exception{Insuffic.pdf
public class InsufficientFundsException extends Exception{Insuffic.pdfpublic class InsufficientFundsException extends Exception{Insuffic.pdf
public class InsufficientFundsException extends Exception{Insuffic.pdfankitcom
 
The java class Account that simultes the Account class.pdf
   The java class Account that simultes  the Account class.pdf   The java class Account that simultes  the Account class.pdf
The java class Account that simultes the Account class.pdfakshay1213
 
Modify the Total program so that it writes the values in two columns.pdf
Modify the Total program so that it writes the values in two columns.pdfModify the Total program so that it writes the values in two columns.pdf
Modify the Total program so that it writes the values in two columns.pdfsaxenaavnish1
 
OOP program questions with answers
OOP program questions with answersOOP program questions with answers
OOP program questions with answersQuratulain Naqvi
 
Hi,I have updated the code as per your requirement. Highlighted th.pdf
Hi,I have updated the code as per your requirement. Highlighted th.pdfHi,I have updated the code as per your requirement. Highlighted th.pdf
Hi,I have updated the code as per your requirement. Highlighted th.pdfannaindustries
 
Write a Java ProgramSolutionAnswer- Code- import java-io--- import jav.docx
Write a Java ProgramSolutionAnswer- Code- import java-io--- import jav.docxWrite a Java ProgramSolutionAnswer- Code- import java-io--- import jav.docx
Write a Java ProgramSolutionAnswer- Code- import java-io--- import jav.docxlez31palka
 
Creating a Facebook Clone - Part XLVI - Transcript.pdf
Creating a Facebook Clone - Part XLVI - Transcript.pdfCreating a Facebook Clone - Part XLVI - Transcript.pdf
Creating a Facebook Clone - Part XLVI - Transcript.pdfShaiAlmog1
 
import java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfimport java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfoptokunal1
 
Write a Java application that asks for an integer and returns its fac.pdf
Write a Java application that asks for an integer and returns its fac.pdfWrite a Java application that asks for an integer and returns its fac.pdf
Write a Java application that asks for an integer and returns its fac.pdfhadpadrrajeshh
 
import java.util.Scanner; public class Rainfall {Scanner s=new.pdf
import java.util.Scanner; public class Rainfall {Scanner s=new.pdfimport java.util.Scanner; public class Rainfall {Scanner s=new.pdf
import java.util.Scanner; public class Rainfall {Scanner s=new.pdfssuserd6ce341
 

Similar to Tmpj3 01 201181102muhammad_tohir (20)

Bank account in java
Bank account in javaBank account in java
Bank account in java
 
Java programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdfJava programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdf
 
Bank Program in JavaBelow is my code(havent finished, but it be .pdf
Bank Program in JavaBelow is my code(havent finished, but it be .pdfBank Program in JavaBelow is my code(havent finished, but it be .pdf
Bank Program in JavaBelow is my code(havent finished, but it be .pdf
 
IP project for class 12 cbse
IP project for class 12 cbseIP project for class 12 cbse
IP project for class 12 cbse
 
I need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdfI need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdf
 
You are not setting any values for those variables(name, ID, interes.pdf
You are not setting any values for those variables(name, ID, interes.pdfYou are not setting any values for those variables(name, ID, interes.pdf
You are not setting any values for those variables(name, ID, interes.pdf
 
Automatically Repairing Test Cases for Evolving Method Declarations
Automatically Repairing Test Cases for Evolving Method DeclarationsAutomatically Repairing Test Cases for Evolving Method Declarations
Automatically Repairing Test Cases for Evolving Method Declarations
 
public class InsufficientFundsException extends Exception{Insuffic.pdf
public class InsufficientFundsException extends Exception{Insuffic.pdfpublic class InsufficientFundsException extends Exception{Insuffic.pdf
public class InsufficientFundsException extends Exception{Insuffic.pdf
 
The java class Account that simultes the Account class.pdf
   The java class Account that simultes  the Account class.pdf   The java class Account that simultes  the Account class.pdf
The java class Account that simultes the Account class.pdf
 
Inheritance
InheritanceInheritance
Inheritance
 
Programs of java
Programs of javaPrograms of java
Programs of java
 
Modify the Total program so that it writes the values in two columns.pdf
Modify the Total program so that it writes the values in two columns.pdfModify the Total program so that it writes the values in two columns.pdf
Modify the Total program so that it writes the values in two columns.pdf
 
programming for Calculator in java
programming for Calculator in javaprogramming for Calculator in java
programming for Calculator in java
 
OOP program questions with answers
OOP program questions with answersOOP program questions with answers
OOP program questions with answers
 
Hi,I have updated the code as per your requirement. Highlighted th.pdf
Hi,I have updated the code as per your requirement. Highlighted th.pdfHi,I have updated the code as per your requirement. Highlighted th.pdf
Hi,I have updated the code as per your requirement. Highlighted th.pdf
 
Write a Java ProgramSolutionAnswer- Code- import java-io--- import jav.docx
Write a Java ProgramSolutionAnswer- Code- import java-io--- import jav.docxWrite a Java ProgramSolutionAnswer- Code- import java-io--- import jav.docx
Write a Java ProgramSolutionAnswer- Code- import java-io--- import jav.docx
 
Creating a Facebook Clone - Part XLVI - Transcript.pdf
Creating a Facebook Clone - Part XLVI - Transcript.pdfCreating a Facebook Clone - Part XLVI - Transcript.pdf
Creating a Facebook Clone - Part XLVI - Transcript.pdf
 
import java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfimport java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdf
 
Write a Java application that asks for an integer and returns its fac.pdf
Write a Java application that asks for an integer and returns its fac.pdfWrite a Java application that asks for an integer and returns its fac.pdf
Write a Java application that asks for an integer and returns its fac.pdf
 
import java.util.Scanner; public class Rainfall {Scanner s=new.pdf
import java.util.Scanner; public class Rainfall {Scanner s=new.pdfimport java.util.Scanner; public class Rainfall {Scanner s=new.pdf
import java.util.Scanner; public class Rainfall {Scanner s=new.pdf
 

Recently uploaded

Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactisticshameyhk98
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 

Recently uploaded (20)

Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 

Tmpj3 01 201181102muhammad_tohir

  • 1. Nama : Muhammad Tohir Nim : 201181102 Seksi :01 Tugas 03 Account import java.util.Scanner; public class Account { public double Balance; public Account(double initialBalance) { if (initialBalance > 0.0) Balance = initialBalance; Scanner input = new Scanner(System.in); } public void credit (double Amount) { Balance = Balance + Amount; } public double getBalance() { return Balance; } }
  • 2. Accounttest import java.util.Scanner; public class accounttest { public static void main (String[]args) { Account account1 = new Account(50.00); Account account2 = new Account(-7.53); System.out.printf("Account1 balance :$%.2fnn",account1.getBalance()); System.out.printf("Account2 balance :$%.2fnn",account2.getBalance()); Scanner input = new Scanner(System.in); double depositAmount; System.out.print("Enter deposit amount for account1:" ); depositAmount = input.nextDouble(); System.out.printf("nadding %.2f to account1 blance nn",depositAmount); account1.credit(depositAmount); System.out.printf("account1 blance : $%.2fn",account1.getBalance()); System.out.printf("account2 blance : $%.2fn",account2.getBalance()); System.out.printf("Enter deposit account for account2: "); depositAmount =input.nextDouble();
  • 3. System.out.printf("nadding %.2f to account2 balancenn", depositAmount); account2.credit(depositAmount); System.out.printf("account1 balance: $%.2fn",account1.getBalance()); System.out.printf("account2 balance : $%.2fn",aaccount2.getBalance()); } }