Putting 2 programs together

I have these 2 individual java progrmas that I want to run together. I would like the programs to first ask for the users name and then output the date and then the users name. Here are the two programs individually:
import javax.swing.*;
import java.util.*; //for Date
import java.text.*; //for SimpleDateFormat
class DateDisplay {
public static void main( String[] args ) {
Date today;
SimpleDateFormat simpleDF1;
today = new Date();
simpleDF1 = new SimpleDateFormat("EE-MM-dd-yy, hh:mm a\nDDD");
//Default short format display
JOptionPane.showMessageDialog(null, "Today is " +
simpleDF1.format(today) +"th day in the year.");
....and
import javax.swing.*;
class HW1 {
public static void main(String[]args) {
String name, first, middle, last, space;
space = " ";
//Input the full name
name = JOptionPane.showInputDialog
(null, "Enter your full name (first, middle, last):");
//Extract first, middle, and last names
first = name.substring(0, name.indexOf(space));
name = name.substring(name.indexOf(space)+1, name.length());
middle= name.substring(0, name.indexOf(space));
last = name.substring(name.indexOf(space)+1, name.length());
//Output the name
JOptionPane.showMessageDialog(null,"Your name is: " + first +
" " + middle +" " + last + "\nReformatted: " + last +"," +" "
+ first +" " + middle.substring(0, 1) +".");
Each of these works on its own but I want them together. How would I go about doing this? Thanks in advance.

Right, I get that. This is my very first attempt at writing code so I'll keep that static thing in mind later. Anyhoo, this is what I've come up with:
/*Travis Mandrell Homework#1
CSC 211 G. Andrus 9/18/05*/
import javax.swing.*;
import java.util.*; //for Date
import java.text.*; //for SimpleDateFormat
class HW1 {
public static void main(String[]args) {
String name, first, middle, last, space;
space = " ";
//Input the full name
name = JOptionPane.showInputDialog
(null, "Enter your full name (first, middle, last):");
//Extract first, middle, and last names
first = name.substring(0, name.indexOf(space));
name = name.substring(name.indexOf(space)+1, name.length());
middle= name.substring(0, name.indexOf(space));
last = name.substring(name.indexOf(space)+1, name.length());
Date today;
SimpleDateFormat simpleDF1;
today = new Date();
simpleDF1 = new SimpleDateFormat("EE-MM-dd-yy, hh:mm a\nDDD");
//Short format display
JOptionPane.showMessageDialog(null, "Today is " +
simpleDF1.format(today) +"th day in the year.\n\nYour name is: " + first +
" " + middle +" " + last + "\nReformatted: " + last +"," +" "
+ first +" " + middle.substring(0, 1) +".");
It compiles and fuctions as written but does it look alright? By alright I guess I mean that nothing appears out of the ordinary. Thanks.

Similar Messages

  • ADOBE DPS - MAGAZINE to TABLET in INDESIGN.....Need to brush up my tablet design in DPS (did it a few yearscback), can anyone recommend on the Adobe site tutorials that I can download, with artworks /buttons / actions and put it together?

    ....Need to brush up my tablet design in DPS (did it a few years back), can anyone recommend on the Adobe site tutorials that I can download, with artworks /buttons / actions and put it together?

    See this forum post here from Bob. Best place to learn DPS is on Adobe TV http://tv.adobe.com/product/digital-publishing-suite/
    If you are specifically looking to learn how to create interactive overlays, go here http://helpx.adobe.com/digital-publishing-suite/help/overview-interactive-overlays.html Watch the videos on "Folio Overlays panel, Part I & Part II"

  • Where is the best place to put programs to start on X/Openbox startup?

    Hi,
    There are several places to put programs to startup when you start X or a WM.  I'm using Openbox and presently have placed these into my .xinitrc file, but I'm not sure this really the best place.  Openbox has a autostart file, which sorta looks like a better bet.
    Any suggestions would be great.
    Thanks,
    Jon

    Hadn't heard of consolekit; it's not clear to me from looking at their website what it's supposed to be offering? Maybe after it matures more, the documentation will improve, and all will become clear.
    When I used Openbox, I just launched everything such as conky from the Openbox autostart file. I guess if you had a weird set up such as some of your Openbox configs sitting on unmounted partitions, their mount commands would go in .xinitrc, otherwise autostart.sh seems better.
    Just IMO of course, do what you want on your own machine :-)
    Last edited by /dev/zero (2011-10-27 21:04:37)

  • I have two accounts how do I put them together?

    I have two accounts how can i put them together so I have only one?

    Currently, it's not possible. All purchases are tied to eack individual account.

  • How to put website together?

    I have designed a pretty basic website design and usually just put it together in softwae my webhost had but it is no onger available and I'm wondering how i would put all this together to host.
    The Layout Goes This Way
    Home Page          - - - - -          Home Page
                                      Photo Page - - - - -           Portrait Page
                                                        - - - - -           Model Page
                                                        - - - - -      Wedding Page
                                                        - - - - -      Event Page
                                                        - - - - -      Sports Page
                                                        - - - - -      Product Page
                                      Video Page
                                      Design Page
                                      Info Page
                                      Blog Page
                                      Contact Page
    Some Pics of layout:
    HOME PAGE                                                                                                     PHOTO PAGE(LIST FOR DIFFERENT PHOTO PAGES OPEN)
    Model Photo Page
    From there with Photo page would just have horizontal scroll to view all images and for Design and Video would just have a Vertical Scroll.
    I realize this is probably really basic but I don't have hours of time to actually find a tuturiol on this so if you could help and message me or point me in a direction for tuturiol on what I'm looking for that would be great!
    Thanks,
    Stew

    Pointing you to tutorials that discuss HTML & it's relationship with CSS won't help you much because you won't understand a word of it.  If you don't have the discipline & time to learn code and web design basics first, Dreamweaver is not the best tool for you.
    As Curtis said, you should probably hire a professional web developer to build your site so you can concentrate on what you do best. 
    If that's not an option.  Then you'll be happier with a consumer-level product such  as Adobe MUSE (beta code name) or SiteGrinder .  The code isn't terrific but results are  adequate for amateurs and hobbyists who don't need a professionally crafted web site.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

  • Cracked my, tried put back together now wont turn on:(:(

    Cracked my screen, tried fixing it but ordered the glass w/o a LCD screen, put back together now wont turn on:(:(. What can I do??

    Order the correct parts and attempt the repair again.
    If you are unable to repair it yourself you will need to take it to a third party repair shop.
    Neither Apple nor an Apple authorised dealer will help as you have dismantled the iPhone yourself.  In the unlikely event they do help they will charge you for the full repair cost.  A third party repairer will be considerably cheaper, assuming you have not damaged it beyond repair.

  • I have 4 diffrent color puzzle pieces and I want to put them together in one design how would I do it?

    I have 4 different color puzzle pieces and I want to put them together in one design how would I do it?

    More info please.
    Do you have the 4 puzzle pieces in 4 separate files? If that is the case...
    1. Create a blank canvas large enough to fit the completed puzzle.
    2. Open one of the piece files.
    3. Select just the piece (minus the background).
    4. Copy the selection to the clipboard (Edit > Copy).
    5. Activate the canvas and paste from the clipboard (Edit > Paste). The piece will be placed on a new layer with transparent background.
    6. Do the same with the other pieces.
    7. Now you can rotate/move the pieces as necessary to fit them together.
    If the 4 pieces originally are in the same file you can do similar: select each piece and copy/paste, etc.
    If this is not your scenario please clarify.

  • Putting two programs together

    Ok these guys want me to finish this project up and Im stilla beginner in this haha. Well I have a program where u input 4 parameters and it does a process in the Console to thread it to another program(this is not my problem) but then I want this data that the other program makes and put it to the graph....I have all of the code ready(or know how I will implement it) but I cannot seem to put his graph into the other program....if you want the code and a better description then you can IM me KrayzeeMunkee400, email me [email protected], or just post here...its appreciated

    You can use getters:public int[] getData () {
        return data;
    }or similar.

  • Installer puts program in ProgramFilesFolder

    Hello,
    First off, I'm running LabVIEW 7.0.  My installer keeps putting my applications into a folder (that it creates) called "ProgramFilesFolder" and not the pre-existing "Program Files" folder.  When I build the app, the Installer Settings tab shows, under Default Installation Directory, "Program Files Directory".  There is nothing else on the list that looks anything like Program Files, so I would assume this is the correct setting.  Has anyone seen this, and if so, how do I get it to install in the correct folder?
    Thanks.

    After a long phone call with a very patient engineer at National Instruments, the problem has been solved.  One of my registry keys, " HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem, Entry:NtfsDisable8dot3NameCreation was set to 1 when it should have been 0.  The engineer knew almost immediately what to do, but he waited patiently on the line while paranoid (or should I say experienced) me had to make a backup of my registry before I would change this one entry.  Since this was a recent development, the engineer at NI thought that perhaps either a recent program install, or a windows update changed the state of the key.
    Thanks for your suggestions, and thanks to David at NI for the solution.

  • Putting java together

    hello people,
    im need to java, i was wonderig if anyone could
    help me out i have some jsp's java script, and ive never
    messed with jave before how would i put these scripts together?

    i need some help if someone is
    willing to help me put the thing i have together on
    my server ... its called webaim and Silicon Monkey
    developed is and i dont have a clue about java cos i have
    never messed with it.. and i really want this on my server.

  • Am I able to put programs like Adobe Photoshop Lightroom onto an iPad?

    I am looking to upgrade my computer to an iPad and I want it to have Adobe Lightroom 4 on it. I would also like to put other things like Diablo on it. Is that a possibility?

    Windows and Mac OS X programs cannot run on iOS (ipad). Many applications have corresponding apps in the spp store, but not all, and some have more limited functionality.iOS apps do tend to be less expensive than their Windows/OS X counterparts.
    If you work extensively with Lightroom, you may not be satified with an iPad, but for the sake of research, look into iPhoto, Adobe Photoshop Touch, as well as the plethera of image and photo mangement/manipulation tools available (there are dozens).

  • Putting songs together as albums

    hello
    i just upgraded to itunes 7 and there i can subdivide my songlist into showing whole albums to make it more clearly arranged (sorry, badly expressed)
    but the program refuses to let appear certain songs in the same album column, even if i rewrite the tags of the files.
    so for example i got 3 songs by singer A but one of them appears under "unknown album", the others appear under the album they are actually from. i can change the tag of the other one but it refuses to appear with the others.
    how can i group them all together?
    with some other artists it just works...
    thanks

    i have checked the info on the files so i am sure that the album info is the same on every song.
    Are all the songs from the same album?
    A spelling or punctuation mistake, or sometimes a trailing space usually causes this after the artists and/or song name, which fools the iPod into thinking that there are two different artists or songs so you end up with multiple copies. The trailing space is the hardest to spot.
    Best way to cure this is to go into iTunes, highlight that artist and/or songs, right click on them and select "get info".
    This brings up the multiple song info window. If you see the "artist" field is left blank, then there is a discrepancy with that name.
    So to correct this, in the artist or song box retype the name, as you would like it, and then click ok. You should do this even if no mistakes are immediately visible.
    Re sync this new artist/song info to your iPod.

  • I have two pictures (one of me and one of my boyfriend).  I want to put them together as one picture

    I have two pictures (face shots of myself and my boyfriend).  How do I put the two pictures together as one picture? 

    One one image, then use File>Place to import as many images as you need.

  • Student licens for one program together with other licens

    I have the "light version" of Adobe Suite through my work place (psd, indd, ai, bridge). Now I need AfterEffects wich is not covered in my work licens. How can I add a licens for After Effects without having to pay for all the programs I already have? I am also a student, can i have a student licens for a single program and use it together with my work licens?

    Moving this discussion to the Adobe Creative Cloud forum.
    Danielajuvall are you wishing to utilize your own membership to After Effects on the same computer you are utilizing a Creative Cloud for Team/Enterprise membership?

  • Putting sequences together

    Being new but learning, how do you put the sequences together when your ready to make your DVD?

    Hello, and welcome to the Forum!
    Tell us more about what you have in mind. What exactly do you mean by +"put the sequences together when your ready to make your DVD?"+ There are a number of things this might mean -
    Nesting sequences in FCE
    Creating chapters
    Distinguishing a 'full-play' movie vs. playing chapter-by-chapter
    Exporting from FCE
    Importing into iDVD; creating iDVD menus
    Something else ...

Maybe you are looking for