Consider the following GUI listener. If the user chooses the menu item “Succeed”, a message saying “Hooray! Your passed!” should be printed to the console. If the user chooses “Fail”, a message saying “Sorry! You failed.” should be printed to the console. If the user chooses “Quit”, the program should terminate. Number your answers as 1 to 5.
PLEASE GIVE IT A THUMBS UP
import java.awt.event.*;
import javax.swing.*;
class text extends JFrame{
static JTextField t;
static JFrame fr;
static JButton s,f,q;
public static void main(String[] args)
{
fr = new JFrame("GUI");
s = new JButton("Succeed");
f = new JButton("Fail");
q = new JButton("Quit");
JPanel p = new JPanel();
p.add(s);
p.add(f);
p.add(q);
fr.add(p);
s.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
System.out.println("Hooray! Your passed!");
}
});
f.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
System.out.println("Sorry! You failed.");
}
});
q.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
System.exit(0);
}
});
fr.setSize(300, 300);
fr.show();
}
}


-/Desktop/CODE/A.java (CODE) - Sublime Text (UNREGISTERED) File Edit Selection Find View Goto Tools Project Preferences Help FOLDERS A.java demo.cpp CODE import java.awt.event. *; import javax.swing.*, html class text extends JFrame{ static JTextField t; node_modules static JFrame fr; static JButton s,f.q; cold.gif public static void main(String[] args) A cool.gif fr = new JFrame("GUI"); <> index.html S = new JButton("Succeed"); f = new JButton("Fail"); /* main.js q = new JButton("Quit"); JPanel p = new JPanel(); sun.png p.add(s); p.add(f); thun.png p.add(); - warm.gif fr.add(p); s.addActionListener(new ActionListener() zero.jpg public void actionPerformed(ActionEvent e) 1.jpg System.out.println("Hooray! Your passed!"); /* A.java 6 a.out }); f.addActionListener(new ActionListener() /* B.java public void actionPerformed (ActionEvent e) E code.txt System.out.println("Sorry! You failed."); data_keyword.se date.dat q. addActionListener(new ActionListener() /* demo.c public void actionPerformed(ActionEvent e) /* demo.cpp System.exit(0); demo.csv }); /* demo.py fr.setSize(300, 300); /* demo.sh fr.show(); /* file1.json /* file2.json }); Line 35, Column 8 Spaces: 2 Java
File Edit View Search Terminal Help nikhil@nikhil-Vostro-15-3568:-/Desktop/CODES java text Hooray! Your passed! Hooray! Your passed! Sorry! You failed. Hooray! Your passed! Sorry! You failed. Succeed GUIO Fail Quit
Consider the following GUI listener. If the user chooses the menu item “Succeed”, a message saying...
Write a contacts database program that presents the user with a menu that allows the user to select between the following options: (In Java) Save a contact. Search for a contact. Print all contacts out to the screen. Quit If the user selects the first option, the user is prompted to enter a person's name and phone number which will get saved at the end of a file named contacts.txt. If the user selects the second option, the program prompts...
Design program so that it correctly meets the program specifications given below. Specifications: Create a menu-driven program that finds and displays areas of 3 different objects. The menu should have the following 4 choices: 1 -- square 2 -- circle 3 -- right triangle 4 -- quit If the user selects choice 1, the program should find the area of a square. If the user selects choice 2, the program should find the area of a circle. If the user...
Using python 3.7.3 Challenge: Rock, Paper, Scissors GamePDF Description: Create a menu-driven rock, paper, scissors game in Python 3 that a user plays against the computer with the ability to save and load a game and its associated play statistics. Purpose: The purpose of this challenge is to assess the developer’s ability to create an interactive application with data persistence in Python 3. Requirements: Create a Rock, Paper, Scissors game in Python named rps.py according to the requirements specified in...
Programming Instructions:Using Java Object Oriented Principles, write a program which produces the code as indicated in the following specifications: Your program must be a console application that provides a user this exact menu:Please select one of the following:1: Add Client to Bank2: Display Clients in the Bank3: Set Bank Name4: Search for a Client5: Exit Enter your Selection: <keyboard input here> The menu must be displayed repeatedly until 5...
The Maybe High School offers a course that prepares students for tertiary-level education. Last year, several students who completed the course matriculated to a tertiary level institution of their choice. Naturally, the college wants to know how well its students did on the exam. You have been asked to write a program to summarize the results. Your program should: Prompt the user to enter the final grades of an indefinite number of students. Note: A final grade greater than or equal to 75 is considered a...
Write a calculator that will give the user this menu options: 1)Add 2)Subtract 3)Multiply 4)Divide 5)Exit . Your program should continue asking until the user chooses 5. If user chooses to exit give a goodbye message. After the user selections options 1 - 4, prompt the user for two numbers. Perform the requested mathematical operation on those two numbers. Round the result to 1 decimal place. Please answer in python and make it simple. Please implement proper indentation, not just...
Objectives: Integer arithmetic, Functions, menus. Write a C++ program that displays the following menu of choices. 1. Find the number of digits in an integer. 2. Find the nth digit in an integer. 3. Find the sum of all digits of an integer. 4. Is the integer a palindrome? 5. Quit Enter a choice: Page 1 of 4 For each of the choices (1, 3, 4), Read a positive integer number and call a function that processes the menu choice...
Java only please Write a program that displays the following menu: Geometry Calculator 1. Calculate the Area of a Circle 2. Calculate the Area of a Triangle 3. Calculate the Area of a Rectangle 4. Quit Enter your choice (1-4): If the user enters 1, the program should ask for the radius of the circle and then display its area. Use the formula: area = ∏r2 Use 3.14159 for ∏. If the user enters 2 the program should ask for...
The purpose of this assignment is to get experience with an
array, do while loop and read and write file operations.
Your goal is to create a program that reads the exam.txt file
with 10 scores. After that, the user can select from a 4 choice
menu that handles the user’s choices as described in the details
below. The program should display the menu until the user selects
the menu option quit.
The project requirements:
It is an important part...
JAVA Write a program that prompts the user to enter a file name, then opens the file in text mode and reads it. The input files are assumed to be in CSV format. The input files contain a list of integers on each line separated by commas. The program should read each line, sort the numbers and print the comma separated list of integers on the console. Each sorted list of integers from the same line should be printed together...