Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   Help me with the codes please (http://www.go4expert.com/forums/help-codes-t1622/)

nairobian_0 14Oct2006 15:49

Help me with the codes please
 
TASK 1
A} To get a degree from the Nairobi university , a student needs to successfully complete 26 modules.A student needs to take 10 modules in year 1 and 8 modules in two subsequent years.A part-time student needs to take a maximum of 8 modules in year 1 and a maximum of of 6 modules in each of subsequent 3 year.

Design a java program that a student could use to select their module choices for each year of their study.The program should be able to inform a student of the modules which have been:
-Successfully passed to date
-Not selected to date
-Failed to date
B} The program developed in part a} is to be exetended to provide the following additional functionality:
.Each student object is to be written into a binary file.
.Display a list of students who have failed 2 or more modules in the course of their study.
.Display a list of students, in alphabetical order, who have completed their degree.

TASK 2
An interface has two buttons labelled "Create" and "Exit".Each time a user presses the "Create" button two circles appear at random postions on the screen.The circles need not be of the same size. Once the user presses the "Exit" button,the program is to display the number of times that:
.The area of the two circles do not Overlap.
.The areas of the two circles Overlap.
.The areas of the two circles totally overlap.
in each case the system is to emit an appropriate audio indicating the nature of the circle overlaps(the 3 diffrent scenarios decribed above).Note that the "Create" button may be pressed a number of times before the "Exit" buttonis pressed which displays the result and ends the program.

TASK 3
A user is interested in an alphabetical list of all the 4-letter words which have been used in a text file.To archiev this, a program is required:
.To read the lines from the text file and transferall the words into a string array whose size should not exceded 10.
.Another part of the progarmm takes the words, one at a time, from the string array and adds it into an ArrayList,provided it is a 4-letter word.Duplicate words are not allowed.
.In addition, the program should be able to provide an alpahbetical list of these 4-letter words.

shabbir 15Oct2006 12:38

Re: Help me with the codes please
 
You have posted it as an Article under the Article / Source code section. I have moved it to the Queries and Discussion forum.

nairobian_0 19Oct2006 14:35

Re: Help me with the codes please
 
pliz help finish with task two
Code:


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class OverlappingCircles extends JFrame implements ActionListener
{
        JButton btnExit=new JButton("Exit");
        JButton btnCreate=new JButton("Create");
        int flag=0;


        public OverlappingCircles()
        {
                setDefaultCloseOperation(EXIT_ON_CLOSE);
                setSize(600,600);
                setTitle("Overlapping Circles");
                Container con=getContentPane();
                flag=1;
                setContentPane(con);
                con.setLayout(new BorderLayout());
                btnCreate.addActionListener(this);
                btnExit.addActionListener(this);

                con.add(btnCreate,"North");
                con.add(btnExit,"South");

        }
        public static void main(String[] args)
        {
                OverlappingCircles x=new OverlappingCircles();
                x.setVisible(true);
        }
        public void actionPerformed(ActionEvent e)
        {
                if (e.getSource()==btnCreate)
                {
                        repaint();
                }
                else if(e.getSource()==btnExit)
                {
                        flag=2;
                        repaint();
                }
        }
        public void paint(Graphics g)
        {
                if (flag==1)
                {
                        int x1=Math.round((int)(Math.random()*600));
                        int x2=Math.round((int)(Math.random()*600));
                        int y1=Math.round((int)(Math.random()*400));
                        int y2=Math.round((int)(Math.random()*400));
                        g.drawOval(x1,y1,100,100);
                        g.drawOval(x2,y2,100,100);
                        //code to count and produce sound
                }
        }

}


shabbir 19Oct2006 14:51

Re: Help me with the codes please
 
Can you please clarify what you are looking for rather than putting the complete assignment of what needs to be done.


All times are GMT +5.5. The time now is 20:54.