Total members 11894 |It is currently Sun Nov 24, 2024 10:16 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Code:
public static void main(String[] argsthrows IOException{
        
        
int nofaktur ;
        
int kodebrang ;
        
double jmltransaksi;
        
double hargabarang;
        
double totalharga;
        
double diskon ;
        
double totalbayar;
DataInputStream input = new DataInputStream(System.in);
System.out.print("input nofaktur ="); nofaktur=Integer.parseInt(input.readLine());
System.out.print("input kodebarang ="); kodebrang=Integer.parseInt(input.readLine());
System.out.print("jmltransaksi = "); jmltransaksi=Integer.parseInt(input.readLine());

if (
kodebrang == 1
{
    
hargabarang 500000;
}
else if (
kodebrang==2
{
    
hargabarang 100000;
}
else 
{
hargabarang 50000;
}

totalharga hargabarang jmltransaksi;{
    
if ((
kodebrang == 1)&&(jmltransaksi >= 10))
diskon =  (int) (100 totalharga);}
else if (((
kodebrang== 1)||(kodebrang== 2)&&(jmltransaksi >= 5)))
diskon =  (int) (100 totalharga);}

 
totalbayar=totalharga-diskon ;
    
System.out.print("hargabarang =");System.out.print(hargabarang);
System.out.print("totalharga =");System.out.print(totalharga);
System.out.print("diskon =");System.out.print(diskon);
System.out.print("totalbayar =");System.out.print(totalbayar);
    }
    }




help me please




Author:

you have to give initial values for within function defined variables which are :
Code:

      int nofaktur 
=0;
        
int kodebrang=;
        
double jmltransaksi=0.0d;
        
double hargabarang=0.0d;
        
double totalharga=0.0d;
        
double diskon=0.0d ;
        
double totalbayar=0.0d;
 


_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 2 posts ] 




cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com