4/22/2021 assignment: Write a program to draw the interface for size calculator. The button can be determined by button[i] [j].setPrefSize(50, 50). Calculator 1 2 3 4 6. 8. 9. Clear 7,
Q: QUESTION 17 What causes an Array Index Out of Bounds exception? When you use an index that is less…
A: To find what causes an array index out of bound exception.
Q: #include #include #include #include typedef struct student{ int grade; char* nameID;…
A: code: #include <stdio.h>#include <string.h>#include <stdlib.h>#include…
Q: Question 4h. Provide output of the following C++ code? #include using namespace std; template…
A: Given, The code is given in C++ language. Code: #include <iostream> using namespace std;…
Q: Estimated Completion Time: 2-3 minutes Which of the following situations will lead to an object…
A: Database Management System(DBMS) is a software for storing and retrieving users data while…
Q: For an array of size 3, what exception will be thrown if the user tried to access element 4?
A: An exception is an event that disrupts the normal flow of the program. It is an object which is…
Q: please code in python Write a function called weighted_avg that takes a list of grades and a…
A: raise allows you to throw an exception at any time.
Q: P2a: Whats printed in main? int main() { char a = 'h'; char b - 't'; char c= 'x'; char d = 'w'; char…
A: OUTPUT will be: twix
Q: Program 3 Write a programmer-defined function to find the area of circle. Add a decorator function…
A: Algorithm: Start Implement a decorator function Error_Handler() which raises an exception if the…
Q: 1. 2. 3. 4. 5. The JDK command to compile a class in the file Test.java is The main method header is…
A: In this question we have to answer some of the related to java code Let's answer
Q: 13.5 (Enable GeometricObject comparable) Modify the GeometricObject class to implement the…
A: Unified Modeling Language (UML) class diagram:
Q: try { try{ throw new Exception();B } catch (Exception e) { return 1; } finally { try { throw new…
A: Given code occurred ERROR. A void return type means you cannot return a value from your…
Q: What will be the two lines displayed after executing the following code? def pair(e,f): ka=e-f api()…
A: The functions in python are defined using the def keyword. The statements in these functions must be…
Q: Program 6 Use nested (or inner) functions, closure and decorators to write menu driven program to…
A: import math def decorator(radius, choice): # decorator function if…
Q: NEED CODE IN ASSEMBLY LANGUAGE AND CODE MUST BE MASM615 COMPATIBLE AND PLEASE RUN PROGRAM ON DOSBOX…
A: .model small ;following macro is used to print a message;argument msg is the strig to…
Q: 1. Write a java program to display the A) Arithmetic exception. B) Array bounds exception. C)…
A: As per out guidelines we are supposed to answer only one question. Kindly repost other questions as…
Q: 13 What changes need to be made to the main method to avoid the compilation error. public class C {…
A: If we throw a checked exception using throw keyword, it is must to handle the exception using catch…
Q: Task 10 Write a python program that finds the corresponding energy values from a list of frequency…
A:
Q: 1. DivideByZeroException as a derived class of Standard Library class runtime_error, that is used to…
A: Summary:In this question, we need to implement a function with its own exception class.
Q: Exercise 3: 1) Read the following code and try to guess what will be its output. import java.util.":…
A: 1) Code: import java.util.*;class Car{private int speed;//declaring private variablepublic void…
Q: Exercise 2: Solve the programming exercise P10.19 on Page 536 on the book. Note: coin class provided…
A: Here is the java program: CoinReader.java import java.io.File;import…
Q: ratie Int partition (int (Jarr, t 1, int h) Ant x Int 1 arr[h]; (11); for (int j 1j h j) AF (arr[j]…
A: The answer is
Q: Task 6 Given a list named my_list. my_list=[10,20,30,40,60,100,2,5] Write a python program that…
A: Write a python program which has an array my_list = [10,20,30,40,60,100,2,5]. This program takes the…
Q: Given a list of 10 names, complete the program that outputs the name specified by the list index…
A: # given list of names names = ['Ryley', 'Edan', 'Reagan', 'Henry', 'Calus', 'Jane', 'Guto', 'Sonya',…
Q: Task 10 Write a python program that finds the corresponding energy values from a list of frequency…
A: the answer is given below:-
Q: Program 4 Write a programmer defined function to find the perimeter of circle. Add a decorator…
A: As per our guidelines, we are supposed to answer only one question. Kindly repost the remaining…
Q: Rename all files which contain the sub-string 'foo', replacing it with 'bar' within a given folder.
A: There are two ways to rename you file according to your distribution of the Linux. If the Linux OS…
Q: ** 12.20 (Remove package statement) Suppose you have Java source files under the direc- tories…
A: Programming approach Importing the required packages in the program. Obtain the file path as…
Q: Create a file named minesweeper.py Create a function that takes a grid of # and -, where each hash…
A: Python code: def count_adjcent_mines(grid): N=len(grid) output=[] for row,inner_list in…
Q: 2 17 10 11 12 13 14 15 16 17 18 19 Write a JSF page that lets the user enter taxable income and…
A: import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; @ManagedBean…
Q: 4h. Provide output of the following C++ code? #include using namespace std; template class A…
A: Given, Programming language = C++ Code: #include <iostream> using namespace std;…
Q: You've been given the task of testing a method called catWhiteSpace in a "Paragraph" object, which…
A: The solution for the above given question is given below:
Q: Note: Write Python code to solve the below problem using exception handling. 1. Define a list with…
A: The solution to the given problem is below.
Q: 18. Which of the following statements are true? You may select multiple answers. A B а. If an…
A: Please find the answers below.
Q: Create an anonymous block that a teacher can run to insert the student's grade on a particular…
A: Tables used: CLASS_ASSESSMENTS Topic Incorporated ==> SQL INSERT; SYSDATE.
Q: Implement a Template Class MyArray (modify/augment example 12.6):
A: The following corrections have been made to the program: The default constructor previously set the…
Q: 10. What happens when 100 divided by 0? A. throws an exception. В. 1 C.0 D. uncertain
A: answer is A throws an exception explanation : It will throws an exception because division by…
Q: b. For an array of size 3, what exception will be thrown if the user tried to access element 4?
A: Generally, an array consists of a fixed size in which each element is accessed using the indices.…
Q: A list of students (student ID, first name, last name, list of 4 test grades) will be transformed…
A: GradeCalculator.java public class GradeCalculator{ public String convertToLetterGrade(double grade){…
Q: ** 12.20 (Remove package statement) Suppose you have Java source files under the direc- tories…
A: Programming approach Importing the required packages in the program. Obtain the file path as…
Q: Write a Python function named add_vegetable that is passed a (possible empty) set of vegetable…
A: ANSWER: 1. Start 2. define function add_vegetable() 3. if names in name 4. then raise ValueError 5.…
Q: This code is giving me problems like that if i drive 1km that it equals R3000 but i cannot see where…
A: Required: This code is giving me problems like that if i drive 1km that it equals R3000 but i cannot…
Q: Implement function getPercentage that takes two inputs : grade and totalGrade and outputs the grade…
A: Create 3 User defined Exceptions inheriting from run_time error Assign the string to what message so…
Q: 23) If x is a char, and values is an int array, then values[x] a) causes a syntax error b) causes an…
A: please see the next step for solution
Q: What is a throw point? 2. What is an exception handler? 3. Explain the difference between a try…
A: As per our company guidelines we are supposed to answer only first three sub-parts. Kindly repost…
Q: Suppose you have Java source files under the directorieschapter1, chapter2, . . . , chapter34. Write…
A: Programming approach Importing the required packages in the program. Obtain the file path as…
Q: Consider the following block. Draw the runtime stacks that result immediately after the statements…
A: Here i explain it then draw stack call:…
Q: 12.20 (Remove package statement) Suppose you have Java source files under the direc- tories…
A: Here is the solution of the above program:
Q: 1. Write a program that creates an array with 100 randomly chosen integers. Your program should…
A: rand() is used to generate random numbers. CPP will not throw error for index out of bound so we…
Q: Suppose you have Java source files under the directorieschapter1, chapter2, . . . , chapter34. Write…
A: import java.io.File;import java.io.FileNotFoundException;import java.io.PrintWriter;import…
I attached a picture of a prompt I was given in my Java class. I value any help I can get. Thank you in advance.
Step by step
Solved in 2 steps
- Computer Science Write a program in the Java language that includes: 1. A class for books, taking into account the encapsulation and getter, setter. 2. Entering books by the user using Scanner 3. LinkedList class for: (Adding a new book - Inserting a book- Searching for a book using the ISBN Number - Viewing all books,delete book). 4. Serial number increases automatically with each book that is entered. 5. Printing the names of books is as follows: Serial - ISBN - Name - PubYear - Price - Notes. 6-Design a main menu that includes: • Add Book • Insert Book • Delete Book • Search . Display . ExitThe following is the specification for the constructor of a EmailFolder class: /*** Creates a new EmailFolder with the given label** @precondition label != null AND !label.isEmpty()* @postcondition getLabel()==label*/public EmailFolder(String label) Assume the variable folders is an array list of EmailFolder objects. Write code that gets the tenth item in the list, assigning it to an appropriate variable. (java)import java.util.ArrayList; /*** A class to hold details of audio files.** @author David J. Barnes and Michael Kölling* @version 2011.07.31*/public class MusicOrganizer{// An ArrayList for storing the file names of music files.private ArrayList<String> files;/*** Create a MusicOrganizer*/public MusicOrganizer(){files = new ArrayList<String>();}/*** Add a file to the collection.* @param filename The file to be added.*/public void addFile(String filename){files.add(filename);}/*** Return the number of files in the collection.* @return The number of files in the collection.*/public int getNumberOfFiles(){return files.size();}/*** List a file from the collection.* @param index The index of the file to be listed.*/public void listFile(int index){if(index >= 0 && index < files.size()) {String filename = files.get(index);System.out.println(filename);}}/*** Remove a file from the collection.* @param index The index of the file to be removed.*/public void…
- public interface StackInterface void push (T element) throws StackoverfloWException; void pop () throws StackUnderflowException; T top () throws StackUnderflowException; boolean isFul1 (); boolean isEmpty(); Show what is written by the following segments of code (see printın on the code), given that iteml, item2, and item3 are int variables, and ali is an object that fits the abstract description of a stack as shown above StackInterface. Assume that you can store and retrieve variables of type int on ali. iteml = 2; item2 = 0; item3 = 6; ali.push (item2); ali.push (item1); ali.push ( iteml+item3); item2 = ali.top ( ); ali.push (item3*item3); ali.push (item2); ali.push (3); iteml = ali.top ( ); ali.pop( ); System.out.println (iteml + " " + item2 + while (!ali.isEmpty( )) + item3); iteml = ali.top( ) ; ali.pop () ; System.out.println (item1) ;2) Suppose you have a linked list class that provides the following methods: // constructor. // returns size of the list. LinkList () int size (); void insertHead (Object data) // insert new data at the head of // the list. // remove and return the Object at // the head of the list. Object removeHead () void insertTail (Object data) // insert new data at the tail of // the list. The class below is an implementation of a stack using the linked list class. Fill in the method implementations: class Stack { private Stack s; public Stack () { public void push (Object x) { } public Object pop () // assume stack is not empty { } public boolean isEmpty() { }Create a Java program that collects 3 animal types from the user, stores them to an Linked List andthen outputs/displays the contents of the Linked List to the user after the third animal type isentered. (Capturing data, use of a loop, use of a linked list, 3 animal types, stringvalue).
- Exception in thread "main" java.lang.NumberFormatException: For input string: "x" for Java code public class Finder { //Write two recursive functions, both of which will parse any length string that consists of digits and numbers. Both functions //should be in the same class and have the following signatures. //use the if/else statement , Find the base case and -1 till you get to base case //recursive function that adds up the digits in the String publicstaticint sumIt(String s) { //if String length is less or equal to 1 retrun 1. if (s.length()<= 1){ return Integer.parseInt(s); }else{ //use Integer.praseInt(s) to convert string to Integer //returns the interger values //else if the CharAt(value in index at 0 = 1) is not equal to the last vaule in the string else {//return the numeric values of a char value + call the SumIt method with a substring = 1 return Character.getNumericValue(s.charAt(0) ) + sumIt(s.substring(1)); } } //write a recursion function that will find…import java.util.ArrayList; /** * This class describes a user of Twitter. A user has a user ID * (e.g. @testudo), a list of tweets, a count of the number of followers, * and a list of users that this user follows. Unlike P5, * there is no upper limit on the number of tweets or users to follow. * * You may NOT import any library class other than java.util.ArrayList. * You may NOT add any instance variables to keep a count of the number * of tweets or users being followed. You may add instance variables * for other purposes as long as they are private. */public class TwitterUser { private String userID; private int followers; private ArrayList<Tweet> listTweets; private ArrayList<TwitterUser> toFollow; /** * A constructor that takes the user's ID. If the ID is null, or * longer than 32 characters, or it does not start with "@", * throw an IllegalArgumentException. * * All other instance variables should be initialized…1. Show the ListStackADT<T> interface 2. Create a ListStackDataStrucClass<T> with the following methods: defaultconstructor, overloaded constructor, copy constructor, getTop, setTop,isEmpty, ifEmpty (if empty throw the exception), push, peek, pop, toString. 3. Create a private inner class of ListStack<T> called StackNode<T> with thefollowing methods: default constructor, overloaded constructor, copyconstructor, getValue, getNext, setValue, setNext 4. Create a BaseConverter class (non-generic) with the following methods: defaultconstructor, inputPrompt, convert [converts a BaseNumber to a convertedString], convertAll [instantiate a String object] , toString, processAndPrint 5. Create a private inner class BaseNumber. The inner class has the following methods: default constructor, overloaded constructor, getNumber, getBase,setNumber, setBase. [Make your private instance variables in the inner classLong type]. 6. Create a BaseConverterDemo class that only…
- Language: Java Rewrite the ADA source code in Java.Within the Java version of the code, change the second half of the first loop so that all assignments to the counting array 'Freq()' are updated in the EXCEPTION portion of the code. There should be no valid updates to 'Freq()' anywhere else in the loop.ADA source code:with Ada.Text_IO , Ada.Integer_Text_IO ;use Ada.Text_IO, Ada.Integer_Text_IO;procedure Grade_Distribution isFreq: array (1..10) of Integer := (others => 0);New_Grade : Natural;Index,Limit_1,Limit_2 : Integer;beginGrade_Loop:loopbeginGet(New_Grade);exceptionwhen Constraint_Error =>exit Grade_Loop;end;Index := New_Grade/10 + 1;beginFreq(Index) := Freq(Index) +1 ;exceptionwhen Constraint_Error =>if New_Grade = 100 thenFreq(10) := Freq(10) + 1;elsePut("Error -- new grade: ");Put(New_Grade);Put(" is out of range");New_Line;end if;end;end loop Grade_Loop;Put("Limits Frequency");New_Line; New_Line;for Index in 0..8 loopLimit_1 := 10 * Index;Limit_2 := Limit_1 + 9;if…The People class holds an unsorted list of humans. Initially, this list is empty. Existing Human objects may be added to the list using an insert method. Upon inserting a Human object, it is added to the array at the next available position and the position value in incremented. If the position value is equal to the size value, do not insert the Human. Instead, throw an exception that your driver can catch to print an error that the People object is full. Create a People class with the following features: Each People object has a statically allocated array of Human objects. Size attribute representing the maximum size of the array. Position attribute representing the next free position in the array. Default constructor with no arguments. Search method that takes a string argument and returns a Human object. This method returns the first Human object with a name matching the string argument. In other words, pass the name of a Human as a string, search the list of humans for…JAVA PROGRAM THIS PROGRAM MUST WORK IN HYPERGRADE. I HAVE PROVIDED THE INPUTS ARS A SCREENSHOT HERE IS A WORKING CODE. import java.io.*;import java.util.*;public class NameSearcher { private static List<String> loadFileToList(String filename) throws FileNotFoundException { List<String> namesList = new ArrayList<>(); File file = new File(filename); if (!file.exists()) { throw new FileNotFoundException(filename); } try (Scanner scanner = new Scanner(file)) { while (scanner.hasNextLine()) { String line = scanner.nextLine().trim(); String[] names = line.split("\\s+"); for (String name : names) { namesList.add(name.toLowerCase()); } } } return namesList; } private static Integer searchNameInList(String name, List<String> namesList) { int index = namesList.indexOf(name.toLowerCase());…