This assignment is obviously not graded, and it's for your own learning. Try to attempt it with a relaxed and a problem solving mindset. I have intentially left some gaps for you to figure out things and find out solutions. Feel free to use whatsapp group as a channel of discussion.
Note: Only attempt part 1 if you are absolute beginner.
- Create a new repository
- Clone your repository
- Create a
your-name.md
file and add your name to it. - Commit and push your changes using CLI (you might face some issues in the last step - figure out yourself how to unblock yourself.)
Note: Only attempt part 1 if you are absolute beginner.
- Create a new project in Intellij
- Design a class ‘Complex ‘with data members for real and imaginary part. Provide default and Parameterized constructors. Write a program to perform arithmetic operations of two complex numbers.
- Run your code in debug mode and observe things around.
- Figure out how to initialize a repository as git repository and then upload it on Github.
- Fork this repository, clone your personal version of repository locally.
- Add a
your-name.md
file tocontrib
directory with contents as your full name and your batch name, also a link to the github repository if you created one. - Commit and push.
- Create and send a Pull Request to this repository.
- Sit and wait for me to approve it and get merged.
- Try to understand what you just did, and how it might help write code in real world.
- Ofcourse, if you find some miskate, please feel free to send a PR to correct it.
- Fork and clone repository. (if not done)
- In the solutions directory, create a new folder with your github username.
- Use that folder as the package to write code for the problem mentioned below.
- Design a base class
Shape
with two double type values -height
andwidth
, with a parametrized constructor to take in values. - Add a method
compute_area()
for calculating area of shape -- by default it returns 0. - Create two child classes:
Triangle
andRectangle
. Overridecompute_area()
and redefine this function in the derived class to suit their requirements. - Finally write a program that accepts if user would like to enter dimensions for Rectangle or Triangle.
Shape shape; if (input == "Triangle") { shape = new Triangle(h, w); } else { shape = new Rectangle(h, w); } printArea(shape);
- printArea takes a
Shape
as input and prints out area. - That's it, commit, push and PR!