Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a) A number is called Digits_Prime if the summation of the digit is a Prime number, otherwise it is called Not_Digit_Prime. For example, number

a) A number is called Digits_Prime if the summation of the digit is a Prime number, otherwise it is called Not_Digit_Prime. For example, number = 142 and the sum of the Digit = 1+4+2= 7, which is a Prime Number. Therefore, 142 is a Digits_Prime number. i) Let the class be named Digit_Prime_Number. Write a main class program that calculates whether the number is Digits_Prime or Not_Digit_Prime considering Object Oriented Concept. (6 marks) ii) Write three (3) data members, such as number, D_Sum and Flag in the above class that are not directly modified by the object. (5 marks) iii) Design a constructor Digit_Prime_Number() that will assign the value for number. (6 marks) iv) Create a method name Prime_Number() to calculate whether the sum of the digit is Prime or otherwise. If it is a Prime number, the method will return true using the Flag; otherwise it will return false. (8 marks)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Logic And Computer Design Fundamentals

Authors: M. Morris Mano, Charles Kime, Tom Martin

5th Edition

0133760634, 978-0133760637

More Books

Students also viewed these Programming questions

Question

What is the diference between team training and team building?

Answered: 1 week ago