Java Case study

Problem Statement:
You owe the credit card company 1000.00 rupee. The company charges you 1.5% per month on the unpaid balance. You have decided to stop using the card and to pay off the debt by making a monthly payment of N rupee a month. Write a program that asks for the monthly payment, the program writes out the balance and total payments so far for every succeeding month until the balance is zero or less.
Sample Input :
Enter the monthly payment: 100
Sample Output:
Month: 1 balance: 915.0 total payments: 100.0
Month: 2 balance: 828.725 total payments: 200.0
Month: 3 balance: 741.155875 total payments: 300.0





package javaapplication1;


public class CompundInterest {


public static void main(String[] args){

double amountdeposit=100000;
int i = 0;
double rateofinterest=0.05;
int finalamount=0;


double Interestamountoftheyear;

System.out.println(“Interest amount for “+i+”year”+amountdeposit);


finalamount=(int) (amountdeposit+Interestamountoftheyear);
System.out.println(“Interest amount for “+i+”year”+finalamount);

while(finalamount<=1000000 && i>1){

finalamount=(int) (finalamount+Interestamountoftheyear);
System.out.println(“Interest amount for “+i+”year”+finalamount);












Framework to build eCommerce mobile applications

Nowadays, there are lots of options to choose from when planning to build a mobile application for your eCommerce store. There are various open source eCommerce platforms Magento2, Magento, Woocommerce, Prestashop, Opencart, Joomla etc. but best is very subjective. It depends on the economical cost and the dedicated server. Magento is by far the best open source platform for the eCommerce Store. Magento already offers SOAP/REST API inbuilt. It is most popular in small size to large businesses. There are lots of Extensions available for Magento and Magento Marketplace.

It’s a great idea to build a mobile application for your eCommerce Store. The mobile application is contributing a tremendous role to creating a competitive advantage for your eCommerce Store. The best mobile application can help you to create a competitive environment for your competitors.

Native mobile application: It is contributing a remarkable effect in the m-commerce market. Today’s software development is all about the user experience. User experience is the key to mobile application’s success. If you want to build an excellent user experience, the native app would be the best option.

The best Mobile app for your eCommerce Store must have all the essential features and functionalities and it should work perfectly according to your business needs & strategy. Also, you need to take care of technology which is used to create the mobile application so that you do not face any performance issues. The mobile application has a great impression in the e-Commerce/m-Commerce industry.

I would like to suggest you to go for Mobikul the Mobile App Builder developed by Webkul. Mobikul is the most exclusive and unique open code platform in the m-commerce industry to build Native iOS and Android applications for major eCommerce platforms like Magento, Magento2, Opencart, Cs-cart and Prestashop.

Mobikul creates iOS and Android mobile applications with open code for both eCommerce store and Marketplace. Also, Mobikul Mobile App Builder works with the most popular m-commerce platforms like –

Mobikul creates fully customized mobile applications for all above-mentioned platforms according to your needs.

What does the Spring framework do? Should I use it? Why or why not?

Spring is a framework that helps you to “wire” different components together. It is most useful in cases where you have a lot of components and you might decide to combine them in different ways, or wish to make it easy to swap out one component for another depending on different settings or environments.

This is what I’ve always understood “dependency injection” to be.

I would suggest a different definition:

“Design your objects so that they rely on an outside force to supply them with what they need, with the expectation that these dependencies are always injected before anybody asks them to start doing their usual jobs.”

Compare that against: “Each object is responsible for going out and finding everything and everybody it needs as it starts up.”

it looks like it necessitates a whole bunch of XML configuration

Well, most of the XML (or annotation-based) stuff is telling Spring stuff like:

  • When someone asks for “HammerStore”, I want you to create an instance of example.HammerStore and return it. Cache the instance for next time, since there only needs to be one store.
  • When someone asks for “SomeHammer”, I want you to ask yourself for a “HammerStore”, and return the result of the store’s makeHammer() method. Do not cache this result.
  • When someone asks for “SomeWrench”, I want you to create an instance of example.WrenchImpl, Use the configuration setting guageAmount and put it into the instance’s setWrenchSize() property. Do not cache the result.
  • When someone asks for “LocalPlumber”, I want to you create an instance of example.PlumberImpl. Put the string “Pedro” into its setName() method, put a “SomeHammer” into its setHammer() method, and put a “SomeWrench” into its setWrench() method. Return the result, and cache the result for later since we only need one plumber.

In this way, Spring lets your connect components, label them, control their lifecycles/caching, and alter behavior based on configuration.

To facilitate [testing] I typically make (at least) two versions of a method : one that uses instance variables, and one that only uses variables that are passed in to the method.

That sounds like a lot of overhead for not a lot of benefit for me. Instead, make your instance variables have protected or package visibility, and locate the unit tests inside the same com.mycompany.whatever package. That way you can inspect and change the instance variables whenever you want during testing.

Java Program to read from Excel File

package com.howtodoinjava.demo.poi;

import java.util.Iterator;

import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class ReadExcelDemo
public static void main(String[] args)
FileInputStream file = new FileInputStream(new File(“howtodoinjava_demo.xlsx”));

//Create Workbook instance holding reference to .xlsx file
XSSFWorkbook workbook = new XSSFWorkbook(file);

//Get first/desired sheet from the workbook
XSSFSheet sheet = workbook.getSheetAt(0);

//Iterate through each rows one by one
Iterator<Row> rowIterator = sheet.iterator();
while (rowIterator.hasNext())
Row row =;
//For each row, iterate through all the columns
Iterator<Cell> cellIterator = row.cellIterator();

while (cellIterator.hasNext())
Cell cell =;
//Check the cell type and format accordingly
switch (cell.getCellType())
System.out.print(cell.getNumericCellValue() + “\t”);
System.out.print(cell.getStringCellValue() + “\t”);
catch (Exception e)