Sinisterly
Help Needed! - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Java, JVM, & JRE (https://sinister.ly/Forum-Java-JVM-JRE)
+--- Thread: Help Needed! (/Thread-Help-Needed--52322)

Pages: 1 2


Help Needed! - Mediocrity_mybb_import6293 - 11-04-2013

Im new to java well the only reason I took it up is because of college.
if I had the choice i would stick to my prefered languages.

Ok so I have a assignment due in that i need to produce a Grading system for a tutor to grade a student
I've got the code working however im now at the stage where I want to make it look more presentable,
So essentially all I want to do is put my code in a box, i've looked on google for tutorials but can't seem to find anything
I presume im searching it right. I dont want you to do it for me I just want guidelines on how to accomplish this preferably easy task the following is my java code.

Code:
/*
Program to allow teachers to grade students.
This program was created in java on 04/11/2013(UK DATE)
version (1.0) Created by Mediocrity
*/
      import cs1.Keyboard;

public class GadingSystem
{
    public static void main (String[] args)
    {
        String reply1;
        String StudentName;
        String StaffName;
        int Grade1;
        int Grade2;
        int Grade3;
        int Grade4;
        int sum;
        int StaffID;
        
        
        

        //this will clearn the terminal window
        System.out.print('\u000C');
            
        System.out.println("Hello Welcome to CAVC Student grading system");
        System.out.println("Please key in your staff ID");
        StaffID = Keyboard.readInt();
        System.out.println("Please key in your staff username");
        StaffName = Keyboard.readString();

      
        if (StaffID < 100)
        {
            do
            {
              
                System.out.println("Congratulations, You're Succsessfully loged in as; " + StaffName);
                System.out.println("You may now grade a student");
                System.out.println("what's the students name");
                StudentName = Keyboard.readString();
            
          
                System.out.println("Enter " + StudentName + " grade for test #1:");
                Grade1 = Keyboard.readInt();
            
                System.out.println("Enter " + StudentName + " grade for test #2:");
                Grade2 = Keyboard.readInt();
            
                System.out.println("Enter " + StudentName + " grade for test #3:");
                Grade3 = Keyboard.readInt();
            
                System.out.println("Enter " + StudentName + " grade for test #4:");
                Grade4 = Keyboard.readInt();
            
                sum = Grade1 + Grade2 + Grade3 + Grade4;
            
                System.out.println(""+ StudentName +"  scored; " + sum + " For the entire course");
            
            
                if (sum > 75)
                {
                    System.out.println("This is an Excellent result");
                }
                else if (sum > 50)
                {
                    System.out.println("This is a satisfactory result");
                }
                else if (sum > 40)
                
                {
                    System.out.println("Unfortunately more practice is needed");
                }
                else
                {
                    System.out.println("Score too low to mark!");
                }
          
            
                System.out.println("Type Yes or yes to grade another student. Anything else quits the program");
                reply1 = Keyboard.readString();
            
            }
            while(reply1.equalsIgnoreCase("yes"));
            System.out.println("Thanks now, Have a nice day :|");
        }
        else
        {
            System.out.println("Sorry Your Staff ID wasn't recognised");
        }
    }          
}


That works fine and displays the following;
[Image: 15d2kug.jpg]

but I want the code inside a box i know perfectly well how to do this in HTML and CSS it's easy;
Code:
<div class=box>
    Grading System
    <form method ="post" action="addMember.php">
      <label for="Grade1">Enter grade for test #1</label>
      <input name="Grade1"/>
      <label for="Grade2">Enter grade for test #2</label>
      <input name="Grade2"/>
        <label for="Grade3">Enter grade for test #3</label>
      <input name="Grade3"/>
      <label for="Grade4">Enter grade for test #4</label>
      <input name="Grade4"/>
        <p>
        <input name="submit" type="Submit" value="Register"/>
        <input name="reset" type="reset" value="Clear Form">
  </form>
</div>

and the CSS would be
Code:
.box {      
        background-color:#3F48CC;
        color:white;
        font-weight:bold;
        margin:120px auto;
        height:350px;        
        width: 400px;
    }

Any ideas on how to do this in JAVA would be greatly appreciated ?


RE: Help Needed! - blackeagle - 11-04-2013

what do you mean by putting ur code in a box ?


RE: Help Needed! - Mediocrity_mybb_import6293 - 11-04-2013

(11-04-2013, 09:16 PM)blackeagle Wrote: what do you mean by putting ur code in a box ?

I dont know the exact way to put it. The outputted code in the picture i want it more presentable? so for instance if i was to make a login system at this moment in time my code is un professional and looks like the following picture
[Image: wda_0903.gif]

however i want it to look more presentable and look more like this.
[Image: forgotpass.php-834.png]

//Ignore the login system its just an example//


RE: Help Needed! - blackeagle - 11-04-2013

@Mediocrity now i see what you mean it's easy in html but i have no idea if you can do something similar in java if it's possible i'd like to know how !!


RE: Help Needed! - Mediocrity_mybb_import6293 - 11-04-2013

(11-04-2013, 09:27 PM)blackeagle Wrote: @Mediocrity now i see what you mean it's easy in html but i have no idea if you can do something similar in java if it's possible i'd like to know how !!


yeah I could do it with my eyes closed in html and css hopefully you can do it in JAVA? ill let you know if i find a way.


RE: Help Needed! - blackeagle - 11-04-2013

well i don't know let's wait and see what others think about this !!


RE: Help Needed! - Slarek - 11-11-2013

Do you have to use Java? And why you want the form to be in a website, can't you do a GUI?
http://stackoverflow.com/questions/10964693/java-embedding-into-html
http://stackoverflow.com/questions/621228/how-do-you-make-websites-with-java
http://docs.oracle.com/javaee/1.4/tutorial/doc/


RE: Help Needed! - The Real Slim Shady - 11-11-2013

Right now you are writing a console application. Unfortunately for you, console applications dont have pretty little boxes with a GUI and such.

There are graphics libraries that should allow you to do this, or something along these lines. but im not familiar with anything in particular.


RE: Help Needed! - Deque - 11-11-2013

For a desktop GUI look into Swing: http://docs.oracle.com/javase/tutorial/uiswing/
For a website GUI into Applets: http://docs.oracle.com/javase/tutorial/deployment/applet/


RE: Help Needed! - Mediocrity_mybb_import6293 - 11-12-2013

(11-11-2013, 05:44 AM)Slarek Wrote: Do you have to use Java? And why you want the form to be in a website, can't you do a GUI?
http://stackoverflow.com/questions/10964693/java-embedding-into-html
http://stackoverflow.com/questions/621228/how-do-you-make-websites-with-java
http://docs.oracle.com/javaee/1.4/tutorial/doc/

Yeah when this is an assignment i have been set in college it has to be written in java
Before i wrote this thread i had no knowledge of java and didnt know about GUI or APPLETS
Thanks for the links they were beneficial to me

(11-11-2013, 06:56 AM)Geoff Wrote: Right now you are writing a console application. Unfortunately for you, console applications dont have pretty little boxes with a GUI and such.

There are graphics libraries that should allow you to do this, or something along these lines. but im not familiar with anything in particular.

Thanks for the advice Smile


(11-11-2013, 08:55 AM)Deque Wrote: For a desktop GUI look into Swing: http://docs.oracle.com/javase/tutorial/uiswing/
For a website GUI into Applets: http://docs.oracle.com/javase/tutorial/deployment/applet/

Awesome this is what im looking for Desktop GUI so i need to look at Swing?