Develop a class which is called decimalclass

Assignment Help Programming Languages
Reference no: EM13781526

Develop a class which is called DecimalClass. This class has two data members. The first one is an integerPart and the second is a decimalPart. For example if num1 is an object of Decimal Class and its integerPart is 100 and decimalPart is 33, the floating point number which num1 represents is 100.33. In this class you need to overload the + (addition) and the - (substraction) operators to add the two objects of DecimalClass. If the sum of the decimalPart after adding two objects are greater than 100 deduct 100 from the DecimalPart and add 1 to integerPart. Similarly if the difference of the decimalPart after subtracting one objects from other is negative, deduct 1 from the intergerPart and add 100 to decimalPart.

Here is an example:

Sum Example:

Object Integer Part Decimal Part

num1 48 31

num2 23 71

num1+num2 72 2

Subtraction Example

Object IntegerPart decimalPart

num1 48 31

num2 23 71

num1-num2 24 60

You need to write a test program (main) which declares at least 4 objects of the DecimalClass and performs the addition and subtraction of the different objects. You should also have functions to display the data members of each object and the results.

Reference no: EM13781526

Questions Cloud

Define the type of organizational structure : Define the type of organizational structure you’ve chosen to investigate and briefly describe its pros and cons. Find an article (in the library or on the Internet) about a company that is structured this way. Chose a company that has sufficient info..
What practical steps could be taken to build a relationship : What practical steps could be taken to build a relationship with a follower of this worldview who might be a co-worker, neighbor, etc.
Expose off-spring to good parenting : In 250 words explain why same sex marriages are considered to be more stable than traditional marriages. Be sure to discuss the leading factors that allow this statement to be a reality when it comes to the ability of parents to expose their off-s..
Moral development are pre-conventional-conventional : The three levels of moral development are pre-conventional, conventional, and principled. Identify and describe the three levels in the six stages of moral development.
Develop a class which is called decimalclass : Develop a class which is called DecimalClass. This class has two data members. The first one is an integerPart and the second is a decimalPart. For example if num1 is an object of Decimal Class and its integerPart is 100 and decimalPart is 33, the..
Why domestic firms expand into global markets : Why domestic firms expand into global markets-A definition of the key term: this does not count in the 200 word minimum requirement
External and internal environmental analysis : Identifies and analyzes the most important external environmental factor in the remote, industry, and external operating environments
Visual information processing : Describe visual information processing. (Make sure to explain the structures and the specific processes.) Explain two conditions that impair visual information processing.
Analysis of variance and two-way analysis of variance : What is the fundamental difference between one-way analysis of variance and two-way analysis of variance?

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd