Question
Asked by:
bclimb1983
bclimb1983
Rating : No Rating
Questions Asked: 6
Tutorials Posted: 0
 

$100.00 Java Programs

Q:
I need the full code for 9 simple java programs. I will also include a tip if the code all works as expected!

The code needs to be as simple as possible while still following the rules of each assingment and must include basic comments on steps taken within code:

1. The formula for converting a temperature from Fahrenheit to Centigrade is C= 5/9 (F-32)
Write a method named centigrade that accepts a Fahrenheit temperature as an argument. The method should return a temperature, converted to centigrade. Demonstrate the method by calling it in a loop that displays a table of the Fahrenheit temperatures 0 through 20 and their centigrade equivalents.

2. A prime number is an number that is only evenly divisible by itself and 1. Wrate a method name isPrime, which takes an integer as an arguments and returns “true” if the argument is a prime number, or false if otherwise. Demonstrate the method in a complete program.

3.Write a class named Car that has the following fields:
yearModel – is an int that holds the car’s year model
make – string object that holds the make of the car
speed – int that holds the current speed
In addition, the class should have the following constructor and other methods. Constructor. The constructor should accept the car’s year model and make as arguments. These values should be assigned to the object’s yearModel and make fields. The constructor should also assign 0 to the speed field. Accessors. Appropriate accessor methods should get the values stored in an object’s yearModel, make, and speed fields. Accelerate. The accelerate method should add 5 to the speed field each time it is called. Brake. The Brake method should subtract 5 from the speed field each time it is called. Demonstrate the class in a program that creates a Car object, and then calls accelerate method 5 times. After each call to the accelerate method, get the current speed of the car and display it. Then call the brake method 5 times. After each call to the brake method, get the current speed of the car and display it.


4. Design a Payroll class that has fields for an employee’s name, ID number, hourly pay rate, and number of hours worked. Write the appropriate accessor and mutator methods and a constructor that accepts the employee’s name and ID number as arguments. The class should also have a method that returns the employee’s gross pay, which is calculated as the number of hours worked multiplied by the hourly pay rate. Write a program that demonstrates the class by creating a Payroll object, then asking the user to enter the data for an employee. The program should display the amount of gross pay earned.

5. A county collects property taxes on the assessment value of property, which is 60 percent of the property’s actual value. If an acre of land is valued at 10,000, its assessment value is 6,000. The property tax is then .64 for each 100 of the assessment value. The tax for an acre assessed at 6,000 will be 38.40. Create a GUI application that displays the assessment value and property tax when a user enters the actual value of the property.


6. Create a class with a method that accepts a charge account number as its argument. The method should determine whether the number is valid by comparing it to the following list of valid charge account numbers:
5658845 4520125 7895122 8777541 8451277 1302850
8080152 4562555 5552012 5050552 7825877 1250255
1005231 6545231 3852085 7576651 7881200 4581002
These numbers should be stored in an array or an ArrayList object. Use a sequential search to locate the number passed an argument. If the number is an array, the method should return “true” showing it is valid. If not it should return “false”. Write a program that tests the class by asking the user to enter a charge account number. The program should display a message indicating whether the number is valid or invalid.

7. Create a class named RoomDimension that has 2 fields: one for the length of a room and one for the width. The RoomDimension class should have a method that returns the area of a room. Then create a RoomCarpet class that has RoomDimension object as a field. It should also have a field for the cost of the carpet per square foot. The RoomCarpet class should have a method that returns the total cost of the carpet. Write a program that asks the user to enter the dimensions of a room and the price per square foot of the desired carpeting. The class should display the total cost of the carpet.

8. Write a class with a constructor that accepts a String object as its argument. The class should have a method that returns the number of vowels in the string, and another method that returns the number of consonants in the string. Demonstrate the class in a program that performs the following steps.
1. The user is asked to enter a string.
2. The program displays the following menu:
a. Count the number of vowels in the string
b. Count the number of consonants in the string
c. Count both the vowels and consonants in the string
d. Enter another string
e. Exit the program
3. The program performs the operation selected by the user and repeats until the user selects e, to exit the program.

9. Write a program that asks the user to enter a series of numbers separated by commas. Here is an example of valid input: 7,9,10,2,18,6. The program should calculate and display the sum of all the numbers.
 


   
   
   
   
 
Available Tutorials to this Question
Posted by:
sudipta
sudipta
Rating (2461): A
Questions Asked: 0
Tutorials Posted: 15317, earned $72,298.00
 

$10.00 Solution to 6 - Charge account number

  • This tutorial was purchased 1 time and hasn't been rated yet.
  • Posted on May 05, 2008 at 8:46:13PM
A:
Preview: ... "You have” + Attempt_Tracker +”attempts.");<br> <br> Scanner in = new Scanner(System.in);<br> System.out.println("Please enter your Account No.");<br> int input = in.nextInt( );<br><br> int charge;<br> boolean validity;<br><br> int[] accNo = { 5658845, 8080152, 1 ...

The full tutorial is about 105 words long plus attachments.

Attachments:
mainSearch.java (1K) (Preview)
Posted by:
b_h
b_h
Rating (671): A+
Questions Asked: 0
Tutorials Posted: 1188, earned $24,653.40
 

$4.00 Program 1

  • This tutorial was purchased 2 times and hasn't been rated yet.
  • Posted on May 05, 2008 at 8:56:31PM
A:
Preview: ... {<br><br> // takes a Fahrenheit temperature and returns the equivalent in centigrade<br> public static double c ...

The full tutorial is about 66 words long .
Posted by:
b_h
b_h
Rating (671): A+
Questions Asked: 0
Tutorials Posted: 1188, earned $24,653.40
 

$10.00 Program 2

  • This tutorial hasn't been purchased yet.
  • Posted on May 05, 2008 at 9:02:04PM
A:
Preview: ... -n;<br> if ( n == 0) return false;<br> // for all numbers from 2 to n - 1<br> for ( int m = 2; m < n; m++) {<br> // if m divi ...

The full tutorial is about 111 words long .
Posted by:
b_h
b_h
Rating (671): A+
Questions Asked: 0
Tutorials Posted: 1188, earned $24,653.40
 

$10.00 Problem 3

  • This tutorial was purchased 1 time and hasn't been rated yet.
  • Posted on May 05, 2008 at 9:13:02PM
A:
Preview: ... accelerate() {<br> speed = speed + 5;<br> }<br> <br> // remove 5 from the speed<br> public void brake() {<br> speed = speed - 5;<br> }<br>}<br><br>public class Program_3 {<br><br><br> public static void main(String args[]) {<br> // make a new car object<br> Car car1 = new Car(2004, "VW");<br><br> // accelerate the car<br> car1.accelerate();<br> // display the speed<br> System.out.println("Current speed : " + car1.getSpeed());<br><br> car ...

The full tutorial is about 207 words long .
Posted by:
b_h
b_h
Rating (671): A+
Questions Asked: 0
Tutorials Posted: 1188, earned $24,653.40
 

$10.00 Problem 4

  • This tutorial was purchased 3 times and rated A+ by students like you.
  • Posted on May 05, 2008 at 9:28:24PM
A:
Preview: ... this.name = n;<br> }<br> // return the ID<br> public int getID() {<br> return ID;<br> }<br> // set the ID<br> public void setID(int i) {<br> ID = i;<br> }<br> // return the payrate<br> public double getPayRate() {<br> return payRate;<br> }<br> // set the payrate<br> public void setPayRate(double d) {<br> payRate = d;<br> }<br> // return the hours worked<br> public double getHoursWorked() {<br> return hoursWorked;<br> }<br> // set the hours worked<br> public void setHoursWorked(double d) {<br> hoursWorked = d;<br> }<br> <br> // compute the gross wages by multiplying hours worked by $ / hour.<br> public double grossPay( ...

The full tutorial is about 291 words long .
Posted by:
b_h
b_h
Rating (671): A+
Questions Asked: 0
Tutorials Posted: 1188, earned $24,653.40
 

$10.00 Problem 5

  • This tutorial hasn't been purchased yet.
  • Posted on May 05, 2008 at 9:46:40PM
A:
Preview: ... lue<br> actualValue = (new Double(strInputValue)).doubleValue();<br><br> if (actualValue < 0 ){<br> // if the number is negative, we end up here<br> JOptionPane.showMessageDialog(null, "Please enter a positive number", "Error", JOptionPane.ERROR_MESSAGE);<br> } else {<br> validInput = true;<br> }<br> <br> } catch ( Exception e ) {<br><br> // if there was a problem turning the input ...

The full tutorial is about 226 words long .
Posted by:
modulo51
modulo51
Rating (110): A-
Questions Asked: 1
Tutorials Posted: 353, earned $2,117.64
 

$5.00 Program 1: Convert Fahrenheit to Celsius

  • This tutorial hasn't been purchased yet.
  • Posted on May 05, 2008 at 9:58:31PM
A:
Preview: ... SoF<br> */<br><br>public class CentigradeDemo {<br><br>// Converts fahrenheit to celsius<br>public static double centigrade( double F){<br> return ((F-32.)/1.8);<br>}<br><br> public static void main(String[] args) ...

The full tutorial is about 170 words long plus attachments.

Attachments:
CentigradeDemo.java (0K) (Preview)
CentigradeDemoTxt.txt (0K) (Preview)
Posted by:
b_h
b_h
Rating (671): A+
Questions Asked: 0
Tutorials Posted: 1188, earned $24,653.40
 

$10.00 Problem 6

  • This tutorial was purchased 1 time and hasn't been rated yet.
  • Posted on May 05, 2008 at 10:01:00PM
A:
Preview: ... 231,3852085,7576651,7881200,4581002 };<br> <br> // compare n to all the numbers in validNumbers, returns true if n is among the valid, else false<br> public static boolean isValid(int n) {<br><br> // for each valid number in the array<br> for (int i = 0; i < validNumbers.length; i++ ...

The full tutorial is about 164 words long .
Posted by:
b_h
b_h
Rating (671): A+
Questions Asked: 0
Tutorials Posted: 1188, earned $24,653.40
 

$10.00 Problem 7

  • This tutorial was purchased 1 time and hasn't been rated yet.
  • Posted on May 05, 2008 at 10:17:09PM
A:
Preview: ... mDimension() {<br> length = 0;<br> width = 0;<br> }<br> <br> // create a new object with the given values<br> public RoomDimension(double l, double w) {<br> this.length = l;<br> this.width = w;<br> }<br> <br> // accessors<br> // return the length<br> public double getLength() {<br> return length;<br> }<br> // set the length<br> public void setLength(double l) {<br> length = l;<br> }<br><br> // return the width<br> public double getWidth() {<br> return width;<br> }<br> // set the width<br> public void setWidth(double w) {<br> width = w;<br> }<br> <br> // compute the area of the room<br> public double area() {<br> return length * width;<br> }<br>}<br><br>class RoomC ...

The full tutorial is about 336 words long .
Posted by:
b_h
b_h
Rating (671): A+
Questions Asked: 0
Tutorials Posted: 1188, earned $24,653.40
 

$10.00 Program 8

  • This tutorial was purchased 2 times and rated A+ by students like you.
  • Posted on May 05, 2008 at 10:42:55PM
A:
Preview: ... e();<br> <br> // create a new Word object<br> Word theWord = new Word(theString);<br><br> String choice = "";<br> while ( !choice.equals("e") ) {<br> // print out the menu<br> System.out.println("a. Count the number of vowels in the string");<br> System.out.println("b. Count the number of consonants in the string");<br> System.out.println("c. Count both the vowels and consonants in the string");<br> System.out.println("d. Enter another string");<br> System.out.println("e. Exit the program");<br> System.out.print("> ");<br> <br> // get the user's input<br> choice = input.nextLine();<br> <br> // handle the user's choice<br> if ( choice.equals("a") ) {<br> System.out.println("There are & ...

The full tutorial is about 432 words long .
Posted by:
cxxliu
cxxliu
Rating (5): A
Questions Asked: 0
Tutorials Posted: 31, earned $100.78
 

$70.00 ALL question answered, nicely documented

  • This tutorial hasn't been purchased yet.
  • Posted on May 05, 2008 at 10:50:40PM
A:
Preview: ... ny question, ...

The full tutorial is about 12 words long plus attachments.

Attachments:
javacode.zip (8K)
Posted by:
b_h
b_h
Rating (671): A+
Questions Asked: 0
Tutorials Posted: 1188, earned $24,653.40
 

$10.00 Program 9

  • This tutorial was purchased 2 times and rated A+ by students like you.
  • Posted on May 05, 2008 at 10:55:58PM
A:
Preview: ... or each character in the user's string<br> for (int i = 0; i < theString.length(); i++) {<br> // check to see that it appears in the string of valid characters<br> isValid = false;<br> for (int j = 0; j < validCharacters.length(); j++) {<br> if (theString.charAt(i) == validCharacters.charAt(j)) {<br> // if the character at position i in the user's string appears in the string<br> // of valid cha ...

The full tutorial is about 244 words long .
Posted by:
b_h
b_h
Rating (671): A+
Questions Asked: 0
Tutorials Posted: 1188, earned $24,653.40
 

$77.00 All Problems in Java

  • This tutorial was purchased 1 time and rated A+ by students like you.
  • Posted on May 05, 2008 at 10:58:49PM
A:
Preview: ... ll programs are inside the attached ZIP file. The java f ...

The full tutorial is about 41 words long plus attachments.

Attachments:
Java_Programs.zip (7K)
Posted by:
KEEMODTAE
KEEMODTAE
Rating : No Rating
Questions Asked: 0
Tutorials Posted: 1, earned $0.00
 

$100.00 Room carpet class

  • This tutorial hasn't been purchased yet.
  • Posted on Jul. 06, 2008 at 12:02:21AM
A:
Preview: ... ns the total co ...

The full tutorial is about 16 words long .
   
Join Now or Log In
Get Tutoring
Get Paid
Academic Honesty