I am trying to convert and sucessfully run my pettycash program in throughthe eclipse IDE in Java. First Ill show where Im at I am lost afterhere then ill show the petty cash program. I am not sure if I am on the right track and dont understand how to import the date and to make the information run in the program


package org.eclipse.lifegame.domain;

public class PettyCash {

private static final String self = null;
private static final String initial = null;
private static Object amt;

public PettyCash() {
}
private static void __init__ (String self2, Object amt2){
self.balance = initial;
}
private static void deposit (String self2, Object amt2){
self.balance = self.balance + amt;};

private static void withdraw(String self2, Object amt2) {
self.balance = self.balance - amt;
if (self.balance < 0)
{System.out.println ("Not enough here");}
else {
return self.balance}


private static void getbalance(String self2){
return self.balance;}
}

#!/usr/bin/python
# Filename: petty cash.py
 
from datetime import date
import string
now = date.today
 
class Account:
     def __init__(self, initial):
         '''Initializes the account data.'''
         self.balance = initial
         print ' (Initializing; balance is %s) ' % self.balance
     def deposit(self, amt):
         '''Deposit amt into account'''
         self.balance = self.balance + amt
         print " (Depositing %s; new balance is %s) " % (amt, self.balance)
         # When this deposit is created, it
         # adds to the balance
         self.balance + amt
     def withdraw(self,amt):
         '''Withraw amt from account'''
         print " (Withdrawing %s; new balance is %s) " % (amt, self.balance)
         # When this deposit is created, it
         # subtracts from the balance
         self.balance = self.balance - amt
     def getbalance(self):
         '''Return the current balance of this account.'''
         return self.balance
def printmenu():
    print "please select a number"
    print "1 Deposit"
    print "2 Withdraw"
    print '3 Balance'
    print '4 Done'
 
    # Get user's choice and return it to caller
    return input (">")
def showbalance(a):
    print "new balance is %s" %  a.getbalance()
def getnumberinput(txt):
    num = 0
    while num == 0:
        val = input(txt)
        num = float(val)
        if num <= 0:
            print "The number needs to be greater than zero."
            num = 0
            
    return num
    
a = Account(1000.00)
print "what is today's Julian date?"
date = input (">")
print 'Todays  Julian date is', date
print "Welcome to the petty cash account"
print "Did you deposit or withdraw money today"
print
 
choice = 0
while choice <> 4:
    choice = printmenu()
    if choice == 1:
        deposit = getnumberinput("how much?")
        a.deposit(deposit)
        
    elif choice == 2:
        # do the withdraw logic here
        withdraw = getnumberinput("How Much?")
        a.withdraw(withdraw)
    elif choice == 3:
        showbalance(a)
        
    elif choice == 4:
        print 'Thank you!'
        showbalance(a)
        print 'done'

You might have to post this one on the Java Forum!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.