Giter Club home page Giter Club logo

mca_javaprogrammig's Introduction

MCA_JavaProgrammig

READ INSTRUCTIONS CAREFULLY

1- Your Program folder should be your_name-universityroll number for example:- arjunsharma-1234567

2- You have to upload only your program folder. Separate files will not be considered and will be marked absent.

3- Your program-folder should contain three files for each question

                                              a- PDF file of hand written program
                                              
                                              b- .java file
                                              
                                              c- screen shot (of whole screen).

4- Your name and roll number should be mention on top of the answer

Q1. Write a java program to, create three files one.txt, two.txt and three.txt (FileWriter class)

  1. Write 5 lines in one.txt using PrintWriter class

  2. Write 5 lines in two.txt using PrintWriter class

  3. Write the content into three.txt in the following manner. Read one line from one.txt and write into three.txt Read one line from two.txt and write into three.txt Repeat the above steps till the content is available in both files

  4. Print the contents of all three files.

Q2. Create an abstract class called "Person" with a member varaible person_name (String), id(int). abstract void setDetails(String name, int id,double salary, int joining_year). Define parameterized constructor to initialize the instance variable of Person.

Create a subclass "Employee" that will inherit "Person" class. The other members of the
Employee class are salary(double), joining_year(int).
parameterized constructor to initialize the instance variable of Employee.

Define following methods in Employee class.

void setDetails(String name, int id,double salary, int joining_year):-
            - This method will take the values from main() method.
            - Initialize the instance variable with these values before checking following condition
                      1. id should be greater then zero if user entered 0 for id then throw user define exception "invalid id".
                      2. salary shpuld be greater then 1000 and less then 4000 otherwise throw user define exception "Invalid salary"
                      3. joining year should be "four digit value" and should be greater then 1994 and less then 2021 otherwise
                         throw user define exception "Invalid year of joining"
 void updateSalary(int years):-
              - This method will calculate the updated salary.
              - if number of years are greater then 3 update salart by incrementing with 5% of previous salary.
              - if number of years are greater then 5 update salart by incrementing with 9% of previous salary.
              - if number of years are greater then 10 update salart by incrementing with 15% of previous salary .
                                      
  Create EmployeeMain containg a main method and fully test your class definations. 
  
  Note:-In this program you have to create three more classes "InvlaidID", "InvalidSalary", "InvalidJoin", 
all three classes will inherit Exception class. (For user define Exceptions) 

mca_javaprogrammig's People

Contributors

20562016 avatar abhishekupadhyay007 avatar akanshabhandarimca avatar akrati116 avatar alpeshramola25 avatar arnavraj65 avatar ashish-b2p avatar ayushrawat98 avatar bhartendu-pant avatar chetanpandeygit avatar dpksingh24 avatar hiteshibhatt avatar javaexampractical avatar manish098rawat avatar naruto0012 avatar naveen348 avatar nitinbisht484 avatar rankitrawat avatar ravinarawat avatar rayadityanegi avatar sagarbhatia21 avatar saqibahmad-ai avatar saumya-gupta-coder avatar saurav120 avatar shivani1816 avatar shubhamuniyal215 avatar vikas-bagri avatar vikashnautiyal avatar vivekbinjola avatar yuvraj7017 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.