Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners plz Help me find the correct programs answers
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


nitesh Sah
plz Help me find the correct programs answers
2 Answer(s)      3 years and 11 months ago
Posted in : Java Beginners


  1. Create a washing machine class with methods as switchOn, acceptClothes, acceptDetergent, switchOff. acceptClothes accepts the noofClothes as argument & returns the noofClothes

  2. Create a calculator class which will have methods add, multiply, divide & subtract

  3. Create a class called Student which has the following methods:

i. Average: which would accept marks of 3 examinations & return whether the student has passed or failed depending on whether he has scored an average above 50 or not.

ii. Inputname: which would accept the name of the student & returns the name.

  1. Create a Bank class with methods deposit & withdraw. The deposit method would accept attributes amount & balance & returns the new balance which is the sum of amount & balance. Similarly, the withdraw method would accept the attributes amount & balance & returns the new balance ?balance ? amount? if balance > = amount or return 0 otherwise.

  2. Create an Employee class which has methods netSalary which would accept salary & tax as arguments & returns the netSalary which is tax deducted from the salary. Also it has a method grade which would accept the grade of the employee & return grade.

  3. Create Product having following attributes: Product ID, Name, Category ID and UnitPrice. Create ElectricalProduct having the following additional attributes: VoltageRange and Wattage. Add a behavior to change the Wattage and price of the electrical product. Display the updated ElectricalProduct details.

  4. Create Book having following attributes: Book ID, Title, Author and Price. Create Periodical which has the following additional attributes: Period (weekly, monthly etc...) .Add a behavior to modify the Price and the Period of the periodical. Display the updated periodical details.

  5. Create Vehicle having following attributes: Vehicle No., Model, Manufacturer and Color. Create truck which has the following additional attributes:loading capacity( 100 tons?).Add a behavior to change the color and loading capacity. Display the updated truck details.

  6. Write a program which performs to raise a number to a power and returns the value. Provide a behavior to the program so as to accept any type of numeric values and returns the results.

  7. Write a function Model-of-Category for a Tata motor dealers, which accepts category of car customer is looking for and returns the car Model available in that category. the function should accept the following categories "SUV", "SEDAN", "ECONOMY", and "MINI" which in turn returns "TATA SAFARI" , "TATA INDIGO" , "TATA INDICA" and "TATA NANO" respectively.

Plz mail me your answers at nitesh_loveguy@yahoo.co.in. Thanks........


Advertisement
View Answers

December 16, 2010 at 12:56 PM


For 3 problem

package com;

import java.io.BufferedReader; import java.io.InputStreamReader;

/** * pote * @author pradeshs */

public class Student { public static void avg(int value1,int value2,int value_3,String name) { int output=(value1+value2+value_3)/3; // calculating average value for 3 subjects System.out.println("Average:::"+output); if(output>=50) // condition for checking whether the student has passed or failed { System.out.println("PASS"); System.out.println("Name of the student:"+name); // task 2- returns name } else { System.out.println("FAIL"); System.out.println("Name of the student:"+name); // task 2- returns name } } public static void main(String[] args) { int value1, value2,value_3; // local variables BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); try { System.out.println("\t\t Average::::::::"); System.out.println("Enter the your name :"); String name =in.readLine(); // Input value from keyboard for name // taken for the second task. System.out.println("Enter the First Subject Mark :"); value_1 = Integer.parseInt(in.readLine()); // Input value from keyboard for first value System.out.println("Enter the Second Subject Mark: "); value_2 = Integer.parseInt(in.readLine()); // Input value from keyboard for second value System.out.println("Enter the Third Subject Mark: "); value_3 = Integer.parseInt(in.readLine()); // Input value from keyboard for third value avg(value1,value2,value_3,name); } catch (Exception e) { System.out.println("Error:::" + e); } } }



December 16, 2010 at 12:59 PM


For Bank Problem

package com;

import java.io.BufferedReader; import java.io.InputStreamReader;

/** * pote * @author pradeshs */ public class Bank {

static int output;                                          // variables are defined at class level

public static void deposit(int amount, int balance) // performs deposit calculation
{
    output = amount + balance;
}

public static void withdraw(int amount, int balance) // performs withdraw calculation
{
    output = balance - amount;
    if (balance >= amount) {
        System.out.println(":::Inside the WithDraw method :::");
    } else {
        System.out.println(":::Inside the WithDraw method :::");
        output = 0;
    }
}

public static void main(String[] args) {
    int amount, balance;                                        // local variables
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    try {
        System.out.println("\t\t BANK ::::::::");
        System.out.println("Enter the Amount value: ");
        amount = Integer.parseInt(in.readLine());               // Input value from keyboard for amount value
        System.out.println("Enter the Balance value: ");
        balance = Integer.parseInt(in.readLine());               // Input value from keyboard for balance value
        deposit(amount, balance);                               // deposit method called for computation
        System.out.println(":::Inside the Deposit method :::");
        System.out.println("New Balance:::" + output);
        withdraw(amount, balance);                              // withdraw method called for compu
        System.out.println("New Balance:::" + output);
    } catch (Exception e) {
        System.out.println("Error:::" + e);
    }

}

}



Related Tutorials/Questions & Answers:
plz Help me find the correct programs answers
plz Help me find the correct programs answers   Create a washing machine class with methods as switchOn, acceptClothes, acceptDetergent, switchOff... INDICA" and "TATA NANO" respectively. Plz mail me your answers
plz help me find a program
plz help me find a program  plz help..i want a source code in jsp for order processing
Advertisements
Help me quickly plz??
Help me quickly plz??  Can you help me to write code quickly this code is a java code take input as double and should use command line arguments and enhanced for statement then find the combine of the numbers plz help quickly
plz help me for this question
plz help me for this question  Apply simplex procedure to solve the L.P.P. maximize z = 3x1 + 4x2 subject to 5x1 + 4x2 ? 200; 3x1 + 5x2 ? 150; 5x1 + 4x2 ? 100; 8x1 + 4x2 ?? 80, x1 ? 0, x2 ? 0
Plz Help Me
Plz Help Me  Write a program for traffic light tool to manage time giving between Main-Street and sub-Street. firstly, give green light for 40... traffic light on the frame. We have used java swing. It may help you. import
plz help me - Java Beginners
plz help me  Deepak I can write a sessioon code plz help me admin_home.jsp page is display but data is not disply plz help me what is wrong
plz help me - Java Beginners
plz help me  Hi, I want to search all field from database using name, and display in text box, then data is update and delete. i want to search name using alphabets a-z, plz reply fast. plz help me this is very urgent
plz Help me - Java Beginners
plz Help me  Hi, I want learn struts,I dont have any idea about this plz help how can i make a framework.If u have any information then plz send my personal id plz tell me that whose software installed.and give me brief
plz help me - Java Beginners
plz help me  Thanks deepak continue response..i face some problem i... is true...but i very confuse that how it is not displayed admin page plz any one give me reponse my persinal given id  Hi ragni, i am sending
plz help me!!!!!!!! - JSP-Servlet
plz help me!!!!!!!!  i`ve set the environment varaibles for tomcat as well as jdk.. but i`m not understanding where i`ve to save my servlet..i.e.... there are compilation errors.. plz do help me.   make sure that you did
plz help me - Java Beginners
plz help me  deepak hw can i create a data grid in jsp and also how can i connect to the data base plz help me  to create data grid in jsp use html tables with borders. to connect to data base use scriptlets. ex
plz check my codings are correct or not...There is an error..i cant find it..
plz check my codings are correct or not...There is an error..i cant find it..  import java.util.Scanner; public class Student { private String indexNo; private String gender; private char initial; private int mark1
i want to find the byte code of a image file ... for my project..plz if anybody help me for java coding i will grateful..
i want to find the byte code of a image file ... for my project..plz if anybody help me for java coding i will grateful..   i want to convert a image file to its byte code format that help me for the pattern matching in my
Is the logic correct to detect IE version..plz let me know
Is the logic correct to detect IE version..plz let me know  <html> <head> <script type="text/javascript"> function...;/head> <body> <form> <input type="button" value="Click me
I didn't gat an output for this code, plz send me a correct code
I didn't gat an output for this code, plz send me a correct code  Hi, Here is my code: import java.awt.event.*; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.*; import java.sql.*; public
plz help me today plz plz - Java Interview Questions
plz help me today plz plz  2.) Suppose list is an array of six elements of type int. What is stored in list after the following java code executes? . for (i = 0; i < 5; i++) { list[i] = 2 * i + 5
Plz help me in writing the code - Java Beginners
Plz help me in writing the code   Write a two user Chess Game. (users must be on different systems
Plz help me in writing the code - Java Beginners
Plz help me in writing the code   Write a two user Chess Game. (users must be on different systems
Intranet Website creation - plz help me
Intranet Website creation - plz help me   hi.. I have assign with the intranet website creation work..right from scratch to end..And honestly I know nothing about it.My domain is totally different .. can anybody pls help me
facing problem plz help me out - Framework
Facing problem plz help me out  hi i am new to servlet i deployed... the web.xml file too parallel to the classes folder now i am facing this problem.plz tell me what to do... error:The requested resource (Servlet servlet
Help me plz in Probablity distribution of Java
Help me plz in Probablity distribution of Java  Hello, I have...% is insert or update queries. Which distribution to use and how to achieve it.. Plz help thanks for your time
PLZ HELP ME. i need php code.
PLZ HELP ME. i need php code.   I want php code for bellow OUTPUT. output is just example but it must be letters only. abc bcd efg jku rgt azs hje qqc wws adt
help me plz befor 27 februry
help me plz befor 27 februry  what is rung with this ?? help me plzzzz import java.util.Scanner; public class Initials { public static void main (String [] args) { String firstname,lastname
please help me to answers this question about C++.....huuhuhuhu
please help me to answers this question about C++.....huuhuhuhu  1) Write a full program for the bubble sort algorithm. User is required to enter specific input numbers and the program will be able to sort the given numbers
please help me to answers this question about C++.....huuhuhuhu
please help me to answers this question about C++.....huuhuhuhu  1) Write a full program for the bubble sort algorithm. User is required to enter specific input numbers and the program will be able to sort the given numbers
interview question plz help me and thers
interview question plz help me and thers  A college is good if it satisfies the following conditions: 1.Its number of students is greater than 1000. 2.If the name ends wih a character 'e', then it should not start with character
help me plz - Java Interview Questions
help me plz  1)write a java program that prompts the user to input a decimal number and print the number rounded to the nearest integer? 2)write...? plz answer my question   Hi Friend, Try the following code: 1
Plz help me with this Question - Java Beginners
Plz help me with this Question  this is java code ------------------------- Consider the following code: int [ ] a = [1, 2, 3]; Object o ="123"; String t = "12"; String w = t + "3"; Boolean b = o.equals (a); Boolean b2
plz help me - Java Interview Questions
plz help me  1)Rewrite the method in exercise 10 such that it use the binary search algorithm instead. the linear search algorithm is suitable... java.util.*; public class LinearSearch{ public int find (final int [] data
Help Me With This Plz - Java Interview Questions
Help Me With This Plz  Write a program that's print a word like(I S E) on the black screen with 0,1 only by using two dimensional array? the 1's will represent the words
java, plz help me in doing this - Java Beginners
java, plz help me in doing this  # Write a small record management application for a school. Tasks will be Add Record, Edit Record, Delete Record.....giving me the error of NoClassDefFoundError
 

 

 

DMCA.com