This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
public class GUI extends JFrame { | |
JPanel left = new JPanel(new GridLayout(3,2,5,5)); | |
JPanel right = new JPanel(new GridLayout(8,1)); | |
JRadioButton boxes [] = new JRadioButton[6]; | |
String country [] = {"Jordan", "Palestine", "Egypt", "Algeria", "Saudi Arabia", "Mauritania" }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
public class GUI extends JFrame{ | |
JLabel unit= new JLabel("calculator"); | |
JTextField input = new JTextField("Enter the number you want to convert it."); | |
JTextField output = new JTextField("the result will be displayed here."); | |
String units [] ={"centimeter","meter"}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
public class GUI extends JFrame implements ActionListener { | |
JButton numbers [] = new JButton[12]; | |
JTextField up; | |
JPanel num; | |
int sum; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
public class GUI extends JFrame implements ActionListener { | |
JButton[] buttons = new JButton[9]; | |
int counter = 0; | |
String currentPlayer = "X"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
public class GUI extends JFrame implements ActionListener{ | |
JPanel left, topRight, bottomLeft; | |
JLabel dollar, can; | |
JTextField dolNum,canNum; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
public class GUI extends JFrame implements ActionListener { | |
JButton numbers [] = new JButton[12]; | |
JTextField up; | |
JPanel num; | |
int sum; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
} | |
public void insertToHead(int val){ | |
if(isEmpty()){ | |
head= new node(); | |
head.data=val; | |
head.next=null; | |
tail=head; | |
} | |
else{ | |
node nn= new nod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class node { | |
int data; | |
node next; | |
} | |
class Slist { | |
static node head; | |
node tail; | |
int count; | |
public Slist(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.Random; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
System.out.print("Enter the size of the array to sort: "); | |
int size = sc.nextInt(); | |
sc.close(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//q1 | |
Question#1 (Constructors): | |
1. Create a class called Rectangle that contains the following data fields: | |
• height as integer. | |
• width as integer. | |
2. The class also contains the following methods: | |
• A no-arguments constructor that initializes Rectangle data fields to their default values. | |
• A two-arguments constructor that initializes Rectangle data fields to specific given values. | |
• A method named getArea() that returns the area of the rectangle. | |
3. In the main method: |
NewerOlder