473,467 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Creating classes

1 New Member
The program should help u work out basic Math tasks, factorials, powers and primes. The option should be placed in a menu



When the program starts it should read:



Welcome to the Math Calculator

Pick the problem you want help with



a) Factorial

b) Powers

c) Prime number

d) Quit



Enter your choice:



If the user selects (a), you prompt the use for a number and then calculate factorial.

(N.B Factorial is calculated by multiplying every number between 1 and X. So if 4 is entered factorial of 4 is 1*2*3*4



If the user selects (b), you prompt the use for two numbers and then calculate the power.



Etc



N.B Program should take either capital or common letter
Nov 21 '07 #1
1 1165
r035198x
13,262 MVP
The program should help u work out basic Math tasks, factorials, powers and primes. The option should be placed in a menu



When the program starts it should read:



Welcome to the Math Calculator

Pick the problem you want help with



a) Factorial

b) Powers

c) Prime number

d) Quit



Enter your choice:



If the user selects (a), you prompt the use for a number and then calculate factorial.

(N.B Factorial is calculated by multiplying every number between 1 and X. So if 4 is entered factorial of 4 is 1*2*3*4



If the user selects (b), you prompt the use for two numbers and then calculate the power.



Etc



N.B Program should take either capital or common letter
Don't be too lazy to do your homework.
Read about the Scanner class, try the code and post back if you get problems with the code.
Nov 21 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Edvard Majakari | last post by:
Greetings, fellow Pythonistas! I'm about to create three modules. As an avid TDD fan I'd like to create typical 'use-cases' for each of these modules. One of them is rather large, and I wondered...
4
by: Altramagnus | last post by:
I have 30 - 40 type of different window. For each type I need about 20 instances of the window. When I try to create them, I get "Error creating window handle" My guess is there is a maximum...
4
by: Gonzalo Aguirre | last post by:
i have a classes diagram like this ------------ * ---------- | Vehicles | ------------------------- | Parking| ------------ vehicles ---------- ^ |...
8
by: Simon Edwards | last post by:
Something thats been bugging me for a while... how do you create a namespace that has many children (namespaces) I.e system.io.blah.blah Iv'e done it by creating a class which contains...
15
by: David Thielen | last post by:
Hi; My ASP.NET app (C# calling J# under .net 2.0) creates a png file in a subdirectory to display as part of the created page. However, the bitmap will not display due to a security violation. ...
1
by: Marcel Hug | last post by:
Hi NG ! I have already written a task about MVC and I tried to get the best informations together. I would like to implement the MVC pattern and it work on the way I did it. At first i know the...
17
by: Lee Harr | last post by:
I understand how to create a property like this: class RC(object): def _set_pwm(self, v): self._pwm01 = v % 256 def _get_pwm(self): return self._pwm01 pwm01 = property(_get_pwm, _set_pwm)
2
by: maykut | last post by:
Hi everybody! I have a problem with creating classes in a java source code.I don't know is it possible. creating an non-existing class and filling it with its constructor java source code?After all...
26
by: nyathancha | last post by:
Hi, How Do I create an instance of a derived class from an instance of a base class, essentially wrapping up an existing base class with some additional functionality. The reason I need this is...
31
by: JoeC | last post by:
I have read books and have ideas on how to create objects. I often create my own projects and programs. They end up getting pretty complex and long. I often use objects in my programs they are...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.