473,811 Members | 2,631 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can someone please convert this pseudo code into Java code? The way I would in Java.

1 New Member
Expand|Select|Wrap|Line Numbers
  1. Dim MyMoney As Single
  2. Dim DRolls As Integer
  3. Dim NRolls As Integer
  4. Dim PRolls As Integer
  5. Dim QRolls As Integer
  6. Dim RemainingChange As Single
  7. MyMoney = 28.24
  8.  
  9. QRolls = Int(MyMoney / 10)
  10. MyMoney = MyMoney - QRolls * 10
  11. DRolls = Int(MyMoney / 5)
  12. MyMoney = MyMoney - DRolls * 5
  13. NRolls = Int(MyMoney / 2)
  14. MyMoney = MyMoney - NRolls * 2
  15. PRolls = Int(MyMoney / 1)
  16. MyMoney = MyMoney - PRolls * 1
  17. RemainingChange = Int(MyMoney * 10) / 10
  18. MsgBox(QRolls)
  19. MsgBox(DRolls)
  20. MsgBox(NRolls)
  21. MsgBox(PRolls)
  22. MsgBox(RemainingChange)
Oct 28 '09 #1
2 3396
chaarmann
785 Recognized Expert Contributor
If you have basic understanding of Java, it should be easy for you. There is nothing difficult inside.
If you have no understanding of Java, you can get the programming basics of java within a few hours to solve this task. What you need here is only the knowledge of chapter 1 of any java beginners tutorial.

So what's the problem?
Why can't you do it yourself?

Please describe where you are stuck.

(Tip: Use the simple System.out.prin t() here instead of reading about the complex Swing/AWT Messageboxes).
Oct 30 '09 #2
Frinavale
9,735 Recognized Expert Moderator Expert
Well the above posted code isn't pseudo code.
It is VB code.

It looks pretty straightforward to me...
What do you have converted into Java so far?
What do you not understand how to convert?

-Frinny
Nov 4 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
1994
by: Michael Lauzon | last post by:
A while back, I had a program that I was working on, while taking Java in a Web Design & Development course -- this was back in 1999 -- not having the mindset of a programmer I failed that part of the course misrably. I had to do the following program, but you can see why I failed, I only managed to write to lines of code. I am wondering if there is anyone who can write it to the following criteria, maybe even make it graphical...I am...
8
4236
by: Johnny Knoxville | last post by:
I've added a favicon to my site (http://lazyape.filetap.com/) which works fine if you add the site to favourites the normal way, but I have some JavaScript code on a couple of pages with a link, which when you click it bookmarks the site (much easier). The favicon is never saved if the site is bookmarked this way. Does anyone have any ideas how to fix this?? This is the code: <script language="JavaScript">
11
3544
by: Lues | last post by:
Hi, I'm trying to protect some data in tables with encription (you know why, don't you ;)) I must confess that I'm not very expirienced in writing code, especially encription code. Can any one, please , send VB code for access which I can c/p into one function. It don't have to be RSA, it can be anything which is easy to
2
28826
by: Barney | last post by:
I have to convert a Java app to .NET, i found and used the conversion tool which converts java to C#, but it only converted about 10% of it, how hard would it be to re-write the java app and keep most of the same logic and could I use alot of the same code? I noticed in the conversion that alot of the java code remained the same, so how close is Java to C#? is there another tool to do this conversion much cleaner and easier to fix when...
1
9667
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the best Newsgroup for support with JAVA?
17
71480
by: Terry Jolly | last post by:
New to C# ---- How do I convert a Date to int? In VB6: Dim lDate as long lDate = CLng(Date) In C#
4
1175
by: =?Utf-8?B?Q2hhcmxlcw==?= | last post by:
Hello all, I'm trying to convert a Java Genetic Programming program to C#. I don't know how to convert the following Java code: Object choice = functionSet.getSelectedItem(choice)).value(); Class cls = ((ProgramChoice) choice; function = (Function) cls.newInstance(); The object "choice" shows that a Subtraction class (i.e. "sub") was selected,
3
2332
by: Ethan Furman | last post by:
len wrote: I've never had the (mis?)fortune to work with COBOL -- what are the files like? Fixed format, or something like a dBase III style? I
0
10792
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information inside an image, hide your complete image as text ,search for a particular image inside a directory, minimize the size of the image. However this is not a new concept, there is a concept called Steganography which enables to conceal your secret...
0
10651
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10392
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10136
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5555
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4341
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.