2. Modify the Fahrenheit program so that it displays a button that when pressed causes the conversion calculation to take place. The user will have the option of pressing Enter in the text field or pressing the button. Have the listener that is already defined for the text field also listen for the button pu
Q: R1 F1 F2 R2 The wheel shown is free to rotate around a fixed axis which passes from its central…
A: Here is the solution:-
Q: 4)Write program that input the user age and print the sentence: a) You are child if the age is less…
A: There is not mentioned any programming language so I used JAVA Step 1 : Declare a variable age and…
Q: Q1/ Write a program (using Switch) to display the name of color by giving the color number s the…
A: import java.util.Scanner;import java.io.*;public class Main { public static void main(String[]…
Q: Modify the code below. The output must not have spaces between the comma and the number. What is the…
A: def a(arr): n = len(arr) arr = arr*n print("[", end = "") print(*arr, sep=',', end = "")…
Q: ion 2: Write a program to display first letter name then four letters later or before
A: Q.
Q: 2. Write a program that generates a two-column table showing Fahrenheit temperatures from -40F to…
A: The given program is in java.
Q: = {a, b}*, w has two consecutive b's or starts with b and ends with a} b(a+b)* + a(a+b)*b a(a+b)* +…
A: Q
Q: Write a program that prompts the user to enter five test scores and then prints the average test…
A: Note: since the programming language is not the question is implemented using C++.
Q: 2.2 Write a program that uses input to prompt a user for their name and then welcomes them. Note…
A: Given : Write a program that uses input to prompt a user for their name and then welcomes them. Note…
Q: 4. Write a program that prompts the user to enter a greeting and a name. The program should output…
A: The above program makes use of Scanner class defined in java.util package. This class takes in user…
Q: Write a program to calculate the GPA in First semester. 1- The program asks the marks out of 100 in…
A: Explanation: Arrays of marks, weight and GPA are created. Input is taken in the marks array, and…
Q: Suppose that FirstNumber is an int variable and the input is: 25 What is the value of FirstNumber if…
A: i=i+1 means i equals the current value of i and then increments it by 1 so the value of i if it's…
Q: inch. 2. Ask the user for a temperature. Then ask them what units, Celsius or Fahrenheit, the…
A:
Q: Edit the program provided so that it receives a series of numbers from the user and allows the user…
A: count=0theSum=0.0while True: number=input("Enter a number or press Enter to quit: ") if…
Q: 7. Write a program that asks the user's name, and then greets the user by name. Before outputting…
A: The problem is based on writing the code to input users' name and to greet the user after converting…
Q: Test whether variable count is greater than 20. If it is, display “Count is greater than 20”.
A: Given: Test whether variable count is greater than 20. If it is, display “Count is greater than…
Q: 1. Write a program that will allow a student to calculate his/her test average of four test scores.…
A: // As per our guidelines we are supposed to answer only one question. Kindly repost other questions…
Q: Ask user to enter first name, last name,and city and then print the. each input could include the…
A: Since no programming language is mentioned, I am using python. As per the given question, we need to…
Q: epts the u
A: Code (Python): name = input("Enter your name: ")age = int(input("Enter your age: "))print("\n" +…
Q: 2. Create a function that loops from 1 to 30 and prints out each value on a separate line, except…
A: PROGRAM CODE: #include <iostream> // include header file for input output…
Q: (Vowel or consonant?) Write a program that prompts the user to enter a letter and check whether the…
A: Code: import java.util.Scanner;//to read inputpublic class Exercise04_13{ public static void…
Q: 2. Write a program calculating the statistics for tests of a hospital by getting data from the user…
A: Algorithm Start Var t, pt, nt, ptr, ntr Accept total test in t Accept total positive test in pt…
Q: Q1: A: Put (T) or (F) and correct the false for the following: A constant is a space in meniory…
A: As per guideline, I'm supposed to answer first 3 questions only. Re-post the other question as…
Q: What is the output of this code segment when the input value of x equal 9, input value of y equal 2…
A: Given value of x=9, y=2 and input symbol = / concepts used here:- Case statement which matches…
Q: 4. Write a program that asks the user to enter two positive integers, the height and length of a…
A: The below given Python program will obey the following rubrics: Displaying message to the user to…
Q: Write a program that displays the current year, month, and day using the time(0) function.
A: Answer: Program Plan Define function displayCurrentDate() for displaying the current date in a…
Q: un the program and please attach the screenshot of the output
A: Required:
Q: | Create a program which prompts the user for a Celsius temperature and convert the I temperature…
A: As no language is specified, here C language has been used to design the code. The code and the…
Q: Write a program that takes as input a single character and will print both the input letter grade…
A: Start input grade from user according to grade print comment using switch statement it handle both…
Q: Create a plot of 6 (Six) Points so that a Graham Scan Sequence runs exactly as follows:…
A: A convex hull is a polygonal structure, corresponding to a polygon, that contains all the…
Q: This is my basic code, i want my program that if i input 4 it will print out * ** *** **** the code…
A: It you want to print them in separate new lines replace space character by new line character at…
Q: You will be required to have your program take input from the user for how many bottles of soda will…
A: Note: As no programming language is mentioned. So I am using python to answer this question. source…
Q: write a program that uses input to prompt a user for their name and then welcomes them. Enter your…
A: CODE: name = input("Enter your name: ") print("Hello", name) OUTPUT: Enter your name: Chuck Hello…
Q: Given a string that contains text. Print all words starting with the letter that the user enters.…
A: Required: Given a string that contains text. Print all words starting with the letter that the…
Q: 3. Create a program that will input a number in kilowatt and display its equivalent measure in…
A: As per our company guidelines we are not supposed to answer more than one question per post and…
Q: Write a program that reads in a grade from the user using JOptionPane. (Remember that the grade is…
A: Programs are a sequence of code that give the machine instructions. To complete those tasks,…
Q: Q6 write a program to select a color by entering the 1" letter of its name and handle the invalid…
A: The answer is
Q: Listed below are number in the table. If the user want to search for 65, what will be the display of…
A: Sequential search is also called as linear search in which target element is searched linearly from…
Q: To resize the window by through a.1 function we use void myReshape (GLsizei ;W, GLsizei H) True…
A: The answer has given below:
Q: Create a program that try to combine two variables of different types and use TWO excepts to be…
A: Exception Handling : * Exception can be defined as an unexpected behaviour or a condition in the…
Q: E2.11 Write a program that asks the user to input • The number of gallons of gas in the tank • The…
A: As Language is not defined i'm going to do it in C++
Q: Task 2: Take a sequence of braces from user entered through the keyboard and tell the user whether…
A: The problem can be solved for traversing over the string and deleting every consecutive open and…
Q: The question is on the picture and the error as well. This is the code that has an error. #include…
A: #include <stdio.h> #include <math.h> /* Fuction declaration */ int reverse(int num);…
Q: Write a program to have the user guess a number stored in the program. If he guesses right, tell him…
A: While doing programming in any programming language, you need to use various variables to store…
Q: To write a regular expression literal that matches the substring of characters "go", you place it…
A: We need to find if the given statement related to regular expression is true or false.
Q: Q6) Write the code of VB program to find the summation of even numbers and odd numbers separately by…
A: Code: Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles…
Q: 26.Temperature Conversion Write a program which prompts the user for a Fahrenheit temperature,…
A: note: since you have not mentioned your preferred programming language. I have attempted it in…
Q: 9. Draw a flowchart to continuously count how many times push-button 1 has been bumped (closed and…
A: Here we draw simple flow chart according to question: ===========================================…
2. Modify the Fahrenheit
conversion calculation to take place. The user will have the option of pressing Enter in
the text field or pressing the button. Have the listener that is already defined for the text
field also listen for the button push.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- DEUGGING PROBLEM // Prompts user for a size using Scanner // Creates a frame with the specified size // that is twice as tall as wide import javax.swing.*; import java.util.*; public class DebugFourteen1 extends JFrame { public DebugFourteen1(int size) { super("This is my frame"); setSize(size, size + 2); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static void main(String[] args) { Scanner kb = new Scanner(System.in); int size; System.out.print("Enter width for frame >> "); size = kb.nextLine(); DebugFourteen1 frame = new DebugFourteen1(size); frame.setVisible(); } }Look at the following applet code snippet: 1 import javax.swing.*; 2 import java.awt.*; 3 public class GraphicsTest extends JApplet 4 { 5 public void init() 6 { 7 getContentPane().setBackground(Color.WHITE); 8 } 9 public void paint(Graphics g) 10 { 11 int[] xCoords = {20, 20, 60, 100, 140, 140, 100, 60}; 12 int[] ycoords = {20, 100, 140, 140, 100, 60, 20, 20}; 13 super.paint(g); 14 g.setColor(Color.YELLOW); 15 g.fillPolygon(xCoords, yCoords, 8); 16 g.setColor(color.BLACK); 17 g.setFont(new Font("SansSerif", Font.BOLD, 35)); 18 g.drawString("SLOW", 35, 95); 19 } 20 } How many vertices does the polygon have? Justify your answer.Please help import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Scanner; public class Main { static public double calcTax(double salary, double taxRate) { double taxOwed = 0; taxOwed = (salary * taxRate) / 100; return taxOwed; } public static void main(String[] args) throws IOException { ArrayList salary = new ArrayList(); ArrayList name = new ArrayList(); ArrayList company_name = new ArrayList(); // int lines = 1; try{ File myFile = new File("taxpayer.txt"); Scanner fileReader = new Scanner(myFile); while(fileReader.hasNextLine()){ String data = fileReader.nextLine(); System.out.println(data); String[] dataArr = data.split(", "); name.add(dataArr[0] + " "+ dataArr[1] );…
- Please create a flowchart for the following program: // Import Scanner classimport java.util.Scanner; // Create a class Trianglepublic class Main{ // Method used to check given three sides form a valid triangle or not public static boolean isTriangle(double a, double b, double c) { // If sum of any two sides is greater than third side if((a+b > c) && (a+c > b) && (b+c > a)) { // Print triangle is valid System.out.println("Three sides form a valid triangle."); // Return true return true; } // If any of the above condition is false else {// Print triangle is invalidSystem.out.println("Three sides form a invalid triangle.\n"); // Return false return false; } } // Method used to compute the area of triangle public static double triArea(double a, double b, double c) { // Compute s double s = (a + b + c) / 2; // Compute the area of triangle double area = Math.sqrt(s*(s - a)*(s - b)*(s - c)); // Return the…BAGEL FILES import javax.swing.JFrame; public class Bagel{//-----------------------------------------------------------------// Creates and displays the controls for a bagel shop.//-----------------------------------------------------------------public static void main (String[] args){JFrame frame = new JFrame ("Bagel Shop");frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new BagelControls()); frame.pack();frame.setVisible(true);}} import java.awt.*;import java.awt.event.*; import javax.swing.*; public class BagelControls extends JPanel{private JComboBox bagelCombo;private JButton calcButton;private JLabel cost;private double bagelCost;public BagelControls(){String[] types = {"Make A Selection...", "Plain","Asiago Cheese", "Cranberry"};bagelCombo = new JComboBox(types);calcButton = new JButton("Calc");cost = new JLabel("Cost = " + bagelCost);setPreferredSize (new Dimension (400,…public class TwoColors 10 { public static void main(String[] args) { Scanner in = new Scanner(System.in); 11 12 13 14 System.out.print("Enter your first favorite color: "); 15 16 // Step 2: Read in the next line of input and assign • it to a String variable color1 17 // 18 19 // Step 3: Trim spaces from both end and convert the // // 20 input to all lowercase and assign it back 21 22 to the same variable 23 24 System.out.print("Enter your second favorite color: "); 25 26 // Step 4: Read in the next line of input and assign 27 // it to a String variable color2 28 29 30 // Step 5: Trim spaces from both end and convert the // // 31 input to all lowercase and assign it back 32 33 to the same variable 34 35 // Step 6: Display a message according to the following: // 36 first color 37 second color message light blue 38 red That's wonderful! light blue 39 red That's even better! That's also great! 40 otherwise 41 42
- FIX THE CODE PROVIDED BELOW Part 2 - Syntax Errors and Troubleshooting The code below has many syntax (and other) errors. Tasks:Compile the code and fix the errors one at a time. // Lab1a.java // This short class has several bugs for practice. // Authors: Carol Zander, Rob Nash, Clark Olson, you public class Lab1a { public static void main(String[] args) { compareNumbers(); calculateDist(); } publicstatic void compareNumbers() { int firstNum = 5; int secondNum; System.out.println( "Sum is: + firstNum + secondNum ); System.out.println( "Difference is: " + (firstNum - secondNum ); System.out.println( "Product is: " + firstNun * secondNum ); } public static void calculateDistance() { int velocity = 10; //miles-per-hour int time = 2, //hoursint distance = velocity * timeSystem.out.println( "Total distance is: " distanace); } } Part 3 - Print Statements and Simple Methods Use "print" and "println" statements, but use method calls to reduce the number of repeated "print"and "println"…Fix this program import java.util.Scanner; public class main { public static void WeShipItBad(String[] args) { int OVERNIGHT_CHARGE = 5; int TWO_DAY_CHARGE = 2; int ECONOMY_CHARGE = 1; Scanner console = new Scanner(System.in); // Scanner object to pass around. // Get item description. String itemDescription = getItemDescription(console); if (itemDescription.equals("")) { System.out.println("Invalid description."); } shipWeight = getShipWeight(scnr); if (shipWeight <= 0.0) { System.out.println(); System.out.println("Invalid weight."); } char shipMethod = getShipMethod(council); shipMethod = Character.toUpperCase(shipMethod); double shipCost = calculateShip(shipWeight, shipMethod); displayResults(itemDescription, shipCost, shipMethod, shipWeight); } public static void getItemDescription(Scanner console) { System.out.println("Enter item description:"); String description =…1 import java.util.Scanner; 3 public class TriangleArea { INM&567 000 2 4 8 9 10 11 12 13 14 15 4567890 16 17 18 19 20 21 } public static void main(String[] args) { Scanner scnr = new Scanner(System.in); } Current file: TriangleArea.java = Triangle triangle1 new Triangle(); Triangle triangle2 = new Triangle(); // TODO: Read and set base and height for triangle1 (use setBase() and setHeight()) // TODO: Read and set base and height for triangle2 (use setBase() and setHeight()) System.out.println("Triangle with smaller area:"); // TODO: Determine smaller triangle (use getArea()) // and output smaller triangle's info (use printInfo())
- Java. Starter code: import java.util.*;public class PoD {public static boolean validateBoard(String[][] gameBoard) {boolean validBoard;//PLEASE START YOUR WORK HERE//PLEASE END YOUR WORK HEREreturn (validBoard);}public static void main(String[] args) {//Instantiate new scanner to read from the console.Scanner in = new Scanner( System.in );int gamePiece;String[][] ticTacToeBoard = new String[3][3];for (int i=0; i<3; i++){for (int j=0; j<3; j++){//Read in boardticTacToeBoard[i][j] = in.next();//Output boardif (j<2){System.out.print(ticTacToeBoard[i][j] + " ");}else{System.out.println(ticTacToeBoard[i][j]);}}}if (validateBoard(ticTacToeBoard)) {System.out.println("Valid board");}else {System.out.println("Invalid board");}}}Compute: z = y √x Ex: If the input is 4.0 3.0, then the output is: 1.0 1 import java.util.Scanner; 2 3 public class MathFunctions { 4 5 6 7 8 9 10 11 12 13 14 15 16 17} public static void main (String[] args) { Scanner scnr = new Scanner(System.in); double x; double y; double z; } X = scnr.nextDouble(); y scnr.nextDouble(); /* Your code goes here */ System.out.printf("%.1f\n", z); // This will output z with 1 decimal place. [I'm having trouble with this Java coding. There are errors in my code but I don't know how to resolve them. //Import Scanner classimport java.util.Scanner; //Import Random classimport java.util.Random; //Driver class/programpublic class ProcessingArrays{ //Main method public static void main(String[] args){ //Create new instance of Scanner object Scanner keyboard = new Scanner(System.in); //Ask user for number of double values System.out.println("How many double numerical entries do you have?\nenter in digits ex: 3"); //Declare variable sizeOfArray of type double //Save user input sizeOfArray int sizeOfArray; sizeOfArray = keyboard.nextInt(); //Create array of size sizeOfArray double[] randomArray; randomArray = new double[sizeOfArray]; //Create new instance of Random object Random rand = new Random(); /*Use for loop to generate and assign random double values to randomArray*/ for(int…