Please write in dr java

Here is the driver:
import java.util.*;
public class SquareDriver {
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
String input ="";
System.out.println("Welcome to the easy square program");
while(true)
{
System.out.println("Enter the length of the side of a square or enter QUIT to quit");
try
{
input = keyboard.nextLine();
if(input.equalsIgnoreCase("quit"))
break;
int length = Integer.parseInt(input);
Square s = new Square();
s.setLength(length);
s.draw();
System.out.println("The area is "+s.getArea());
System.out.println("The perimeter is "+s.getPerimeter());
}
catch(DimensionException e)
{
System.out.println(e.getMessage());
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}
}//Square.java
public class Square {
private int length;
public void setLength(int length) {
this.length = length;
}
public void draw() {
for(int i = 0;i<length;i++){
for(int j = 0;j<length;j++){
System.out.print("*");
}
System.out.println();
}
}
public int getArea() {
return length*length;
}
public int getPerimeter() {
return 4*length;
}
}
----------------------------------------------------------------------------------------------------------------------
//SquareDriver.java
import java.util.*;
public class SquareDriver {
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
String input ="";
System.out.println("Welcome to the easy square program");
while(true)
{
System.out.println("Enter the length of the side of a square or enter QUIT to quit");
try
{
input = keyboard.nextLine();
if(input.equalsIgnoreCase("quit"))
break;
int length = Integer.parseInt(input);
Square s = new Square();
s.setLength(length);
s.draw();
System.out.println("The area is "+s.getArea());
System.out.println("The perimeter is "+s.getPerimeter());
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}
}

Please write in dr java Here is the driver: import java.util.*; public class SquareDriver { public...
// please i cant understand why this program isnot running HELP me please? import java.util.Scanner; public class String { public static void main(String[] args) { double Sside, Rlength, Rwidth, Tbase, Theight, Area, Tarea, Rarea; String input; Scanner keyboard = new Scanner(System.in); System.out.print("To Calculate the are of Square Enter 'Square', For Rectangle Enter 'Rectangle', For Triangle Enter 'Triangle'"); input = keyboard.nextLine(); if (input.equalsIgnoreCase("SQUARE")) { System.out.println("Square Side"); Sside = keyboard.nextInt(); Tarea = Sside * Sside; System.out.println("Side = " + Tarea ); }...
This is the contents of Lab11.java
import java.util.Scanner;
import java.io.*;
public class Lab11
{
public static void main(String args[]) throws IOException {
Scanner inFile = new Scanner(new File(args[0]));
Scanner keyboard = new Scanner(System.in);
TwoDArray array = new TwoDArray(inFile);
inFile.close();
int numRows = array.getNumRows();
int numCols = array.getNumCols();
int choice;
do {
System.out.println();
System.out.println("\t1. Find the number of rows in the 2D
array");
System.out.println("\t2. Find the number of columns in the 2D
array");
System.out.println("\t3. Find the sum of elements...
I need help running this code. import java.util.*; import java.io.*; public class wordcount2 { public static void main(String[] args) { if (args.length !=1) { System.out.println( "Usage: java wordcount2 fullfilename"); System.exit(1); } String filename = args[0]; // Create a tree map to hold words as key and count as value Map<String, Integer> treeMap = new TreeMap<String, Integer>(); try { @SuppressWarnings("resource") Scanner input = new Scanner(new File(filename));...
Looking for some simple descriptive pseudocode for this short Java program (example italicized in bold directly below): //Create public class count public class Count { public static void main(String args[]) { int n = getInt("Please enter an integer value greater than or equal to 0"); System.out.println("Should count down to 1"); countDown(n); System.out.println(); System.out.println("Should count up from 1"); countUp(n); } private static void countUp(int n) {...
****Here is the assignment **** Purpose: To write an Object-Oriented application that creates a Java class with several instance variables, a constructor to initialize the instance variables, several methods to access and update the instance variables’ values, along with other methods to perform calculations. Also, write a test class that instantiates the first class and tests the class’s constructor and methods. Details: Create a class called Rectangle containing the following: Two instance variables, An instance variable of type double used...
import java.util.Scanner; import java.io.File; public class Exception2 { public static void main(String[] args) { int total = 0; int num = 0; File myFile = null; Scanner inputFile = null; myFile = new File("inFile.txt"); inputFile = new Scanner(myFile); while (inputFile.hasNext()) { num = inputFile.nextInt(); total += num; } System.out.println("The total value is " + total); } } /* In the first program, the Scanner may throw an...
Please provide the full code...the skeleton is down below: Note: Each file must contain an int at the beginning, stating the number of records in the file. Afterwards, the number of records in the file will follow. Each record that follows will consist of a last name (String), and a gpa (double). However, to test the error handling of your program, the number of records will not always match the int value. All possible combinations should be tested. 1.) Prompt...
In java need help with the TODO sections creating recursive methods public class CountUpDown { /** * countUp - a recursive function that counts up from 1 to n * * @param n the integer value to count up to */ private static void countUp(int n) { // TODO PRELAB // IMPLEMENT THIS RECURSIVE METHOD } /** * countDown - a recursive function that counts down from n to 1 * * @param n the integer value to count down...
Why does my program generate [] when viewing all guests names? ----------------------------------------------- import java.util.*; public class Delete extends Info { String name; int Id; int del; public Delete() { } public void display() { Scanner key = new Scanner(System.in); System.out.println("Input Customer Name: "); name = key.nextLine(); System.out.println("Enter ID Number: "); Id = key.nextInt(); System.out.println("Would you like to Delete? Enter 1 for yes or 2 for no. "); del = key.nextInt(); if (del == 1) { int flag = 0; //learned...
Java Program 1. Write a class that reads in a group of test scores (positive integers from 1 to 100) from the keyboard. The main method of the class calls a few other methods to calculate the average of all the scores as well as the highest and lowest score. The number of scores is undetermined but there will be no more than 50. A negative value is used to end the input loop. import java.util.Scanner; public class GradeStat {...