computer management 1 Answer(s) 3 years and 2 months ago
Posted in : Java Beginners
Create a class Computer that stores information about different types of Computers available with the dealer. The information to be stored about a single computer is, - Company Name - RAM size. - Hard Disk Capacity. - Processor Speed. - Processor Make. - Price . - Quantity of the Computers.
This class contains following methods, - Constructor method that assigns user input values to above mentioned variables.
- main ( ) method that creates array of 4 objects of Computer class and that takes input for all above details from the user and calls method to check validity of Quantity and Price values. If all values are valid then create the objects and display the details for all 4 toys.
- Method that checks validity of quantity and price. If the quantity is 0 or negative then method should throw user defined exception with appropriate message and come out of program. Similarly if the price is 0 or negative then it should throw user defined exception with appropriate message and come out of program.
- Method that displays all details about a single instance of Computer in the following Format.
Computer Name : IBM RAM Size : 512 MB Processor Make : Intel Processor speed : 300 Quantity : 50 Total Price of Computers : 150,0000/- */
View Answers
April 23, 2010 at 4:45 PM
Hi Friend,
Please try the following code:
import java.util.*;
public class Computer{ static String name; static int size; static int speed; static String make; static double price; static int quantity; public Computer(String n,int s,int sp,String m,double p,int q){ name=n; size=s; speed=sp; make=m; price=p; quantity=q; } public String getName(){ return name; } public int getSize(){ return size; } public int getSpeed(){ return speed; } public String getMake(){ return make; } public double getPrice(){ return price; } public int getQuantity(){ return quantity; } public void valid(){ if((price==0)||(price<0)){ System.out.println("Please enter price"); System.exit(0); } else if((quantity==0)||(quantity<0)){ System.out.println("Please enter quantity "); System.exit(0); } else{ displayData(); } } public void displayData(){ List<Computer> list = new ArrayList<Computer>(); list.add(new Computer(name,size,speed,make,price,quantity)); for (Computer s : list){ System.out.println("Computer Name: "+s.getName()+ "\nRAM Size :"+s.getSize()+"\nProcessor Make: "+s.getMake()+"\nProcessor Speed: "+s.getSpeed()+"\nQuantity: "+s.getQuantity()+"\nTotal Price of Computers: "+s.getPrice()); } } public static void main(String[]args){ System.out.println("Enter details"); Scanner input=new Scanner(System.in); System.out.println("Computer Name: "); name=input.next(); System.out.println("RAM Size: "); size=input.nextInt(); System.out.println("Processor Speed: "); speed=input.nextInt(); System.out.println("Processor Make: "); make=input.next(); System.out.println("nQuantity: "); quantity=input.nextInt(); System.out.println("Price: "); price=input.nextDouble(); Computer c=new Computer(name,size,speed,make,price,quantity); c.valid(); } }
Thanks
Related Pages:
computer management - Java Beginners computer management Create a class Computer that stores information... to be stored about a single computer is,
- Company Name
- RAM size... array of 4 objects of Computer
class and that takes input for all above
Computer dealer management - Java Beginners Computer dealer management Create a class Computer that stores.... The information to be stored about a single computer is,
- Company Name
- RAM size... ( ) method that creates array of 4 objects of Computer class and that takes input for all
Management
Management Hi,
Can anyone give me full details of Management?
Thanks
Hi,
Please see the thread What is management?
Thanks
Computer Networks Computer Networks The IPV4 packet has arrived wtih first few hexadecimal digits as 0X45000028000100000102.
How many hopes will this packet travel before being dropped
Computer Networking Computer Networking
 ... a commercial activity where you were using a computer along with a
printer... the sharing and exchanging facilities among the
computer machines is called
Define computer software.
Define computer software. How to define a computer software?
A computer software is a set of instruction that tell the computer what to do
Computer shop mangerment Computer shop mangerment Part A
You are supposed to write a class Computer to stores the computer id, description, brand,
price, speed and another... of it.
Part B
Develop array based java program to help a local computer shop
List of Computer Software
List of Computer Software Hi,
I am looking for the list of Computer programming languages. Provide me the list of Computer Software used these days... for different purposes.
See the List of Computer software.
Thanks
computer - Swing AWT
computer What is a Computer and why we should use it? I am new to this technologies so please let me know the benefits of using computer. What you what to know about computers?Is it a software or hardware related
a computer network is referred as
a computer network is referred as The structure of interconnecting of nodes of --- a computer network is referred as
1. Network topology
2. Internet
3. Local Area network
4. Wide Area network
5. All of these
Answer
The input device used by computer is
The input device used by computer is The input device used by computer is
1. Motherboard
2. Central Processing Unit
3. Keyboard
4. System Unit
5. All of the above
Answer: 2. Central Processing Unit
computer configuration - Java Beginners computer configuration someone posted a code but tha is not working... a working code
Create a class Computer that stores information about... about a single computer is,
- Company Name
- RAM size.
- Hard Disk Capacity
characteristics of a modem computer
characteristics of a modem computer Which of the following describe one or more characteristics of a modem computer?
1. An electronic device
2. A mechanical device
3. A Electro-mechanical device
4. All of these
5. None
ALU Computer Term
ALU Computer Term What is ALU? Please define and explain ALU in simple language.
ALU stands for Arithmetic logic unit is a brain of CPU, which is used for the processing of data and information provided
Computer security - Security computer security advice Can any one give me a computer security advice? Thanks! Please take care whenever you are formatting your hard drive as when you format a hard drive, you erase all its files and prepare
Getting Computer Date in java
Getting Computer Date in java Hi , I want to get the PC Date and insert it to a DB, specifically MSSQL..
Everything in my scriptlet works but this..
String strDate = new Date();
I get this server error, "The type Date
java with computer network
java with computer network i feel it's very difficult to use java for network programming.
how can i recover this problem?give me any simple example with explanation.
hi,
if you want to make carrier in software
computer manufacture case study computer manufacture case study Computer Manufacturer Case Study
BNM is an upcoming computer manufacturer. The company was making a mark in the
desktop and laptop segment due to aggressive pricing and good products. The sales
Vehicle fleet management systems
Vehicle fleet management systems are in huge demand throughout the world... of fleet. They always look for systems that can help in proper management of their vehicle.
Though many fleet management systems are available in the market one
Worst Management Decisions in the History of Business
The world of business is governed by the management decisions and excellence... with the importance of the management decision and proven excellence many a times a bad management decision has been instrumental in worsening the business
Database Management System (DBMS)
Database Management System (DBMS)
A Database Management System... of computer programs that controls the creation, organization, maintenance, and retrieval of data from the database stored in a computer. It allows the individuals
different types of storage devices of a computer
different types of storage devices of a computer What are the different types of storage devices of a computer?
Magnetic disks, Tapes and DVDs are few examples of storage devices of a computer
Vehicle Tracking and Fleet Management
Past decade has seen the advent of vehicle tracking and fleet management... it is downloaded to the computer while Active devices gives information in real-time... of information that they can get, even the driver's behaviour.
Fleet management is done
GPS Vehicle Management management is necessary whether it is a private business or a government one... and stores or transmits the same information to the computer where it can... with the situation.
GPS has brought a far-reaching change in the management
Computer Scince 1015 - Java Beginners Computer Scince 1015 Write a SavingsAccount class to store the following information related to a bank account: Account number, Password, Branch name, Surnames, First names, Balance The account balance should be able
GPS Fleet Control Management Service
GPS Fleet Control Management Service
A real time GPS Fleet Control Management... management service are used in most
transportation industries including road... transport GPS fleet control management
system use it mostly to prevent
The Greatest Management Decisions that made the History
In the history of business and professional management a great range.... There are some of the management decisions in the world history of business... civilization and scientific thought process. The greatest management decisions
Project Management Tools
.
Project Management Softwares:
Computer technology has made project management...Project Management is a complex phenomenon, which requires lots of activities....
Project Management Tools can be a set of specific tools designed especially
Open Source content Management System
Open Source content Management System
The Open Source Content Management System
OpenCms is a professional level Open Source Website Content Management System. OpenCms helps to create and manage complex websites easily without
Get computer name in java
Get computer name in java
We can get the computer name by the java code program.
For getting computer name we have used java.net.InetAddress class. We
will use static
Ask DBMS Questions online
;
DBMS stands for Data Base Management System (DBMS) is a set of computer programs that controls the creation, organization, maintenance, and retrieval of data from the database stored in a computer
Computer Architecture and Programming Languages Computer Architecture and Programming Languages
CPU - Central Processing Unit - The "brains" that performs the computations.
Main Memory - Where... programs and data.
IFSM 310 is an entire course about computer
GPS tracking fleet management
GPS tracking fleet management
A GPS Fleet Tracking System is a technology... is extensively used in fleet management to track the vehicles to enhance... tracking systems are extensively for fleet management by the fleet operators
Learn Management
Learn Management Hi,
How to learn Management online?
Thanks
Hi,
You can learn management at Management tutorials section.
Thanks
attendance management
VB attendance management software i want source code for attendance management system in vb.net.
attendance management
attendance management software in Visual Basic i want source code for attendance management system in vb.net.
attendance management
How to develop a attendance management software i want source code for attendance management system in vb.net.
attendance management
Java attendance management application i want source code for attendance management system in vb.net.
attendance management
attendance management application i want source code for attendance management system in vb.net.
What is Management?
What is Management? Hi,
I am beginner in the software Industry. Can anyone tell about Management. I want to know What is Management?
Thanks
How GPS is used in Fleet Management system
Most of the people ask this question that how GPS is used
in fleet management...
fuel and lots of time. Since fleet management involves delivery timing GPS... by installing a GPS
device in each of the vehicle and linking to a computer
what type of computer memory is used for temporary storage
what type of computer memory is used for temporary storage what type of computer memory is used for temporary storage
RAM or Random Access Memory is a computer memory that is used for temporary storage of data. RAM
Event management
Event management Hi,
I want event management application like maintaining email notifications while task creation and update in broader way using spring java