Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

import java.text.NumberFormat;
import java.util.Locale;

public class Client
{
   // instance data
   private String name;
   private long income_this_year;
   private double percent_cut;
   
   // static data
   public static final int MIN_INCOME_VAL = 0;
   public static final int MAX_INCOME_VAL = 50000;
   public static final int MIN_NAME_LEN = 2;
   public static final int MAX_NAME_LEN = 20;
  
   // default constructor
   Client()
   {
      name = "undefined";
      income_this_year = MIN_INCOME_VAL;
      percent_cut = 0;
   }
  
   // parameter constructor
   Client(String str_name, long annualIncome, double cut)
   {
      if (!SetClient(str_name, annualIncome, cut))
         SetClient();
   }
  
   public void SetClient()
   {
      SetClient("undefined", MIN_INCOME_VAL, 0.0);
   }
  
   // accessor
   String GetName() { return name; }
   long GetIncome() { return income_this_year; }
   double GetCut() { return percent_cut; }
  
   // mutators
   public boolean SetClient(String str_name, long annualIncome, double cut)
   {
      if (str_name.length() > MIN_NAME_LEN || str_name.length() < MAX_NAME_LEN
            && annualIncome > MIN_INCOME_VAL ||
            annualIncome < MAX_INCOME_VAL
            && cut > 0.0 || cut < 100.0)
      {
         name = str_name;
         income_this_year = annualIncome;
         percent_cut = cut;
         return true;
      }
      return false;
   }
  
   NumberFormat currencyFormat = NumberFormat.getCurrencyInstance(Locale.US);
  
   public String ToShow()
   {
      String display = "\nClient: "
            + "\n Name: \t\t\t" + name
            + "\n Annual Income: \t" + currencyFormat.format(income_this_year)
            + "\n Percent cut: \t\t" + percent_cut + "%";
      return display;
   }
  
   // method Display()
   public void Display()
   {
     
      System.out.println(ToShow());
   } 
}

Java, Programming

  • Category:- Java
  • Reference No.:- M9522962

Have any Question?


Related Questions in Java

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

Object-oriented software development1 introduction 11

OBJECT-ORIENTED SOFTWARE DEVELOPMENT 1. Introduction 1.1 Assignment Requirement 1.2 Deliverables and Structure (what to submit) 1.3 Software Restrictions 1.4 How to score high... 1.5 Assumptions 2. System Requirements 2. ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Assessment instructionsin this assessment you will complete

Assessment Instructions In this assessment, you will complete the programming of two Java class methods in a console application that registers students for courses in a term of study. The application is written using th ...

Assignment - java program using array of objectsobjectives

Assignment - JAVA Program using array of objects Objectives - This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details - For this assignment, you are required to develop a Menu ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As