473,403 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

overflow calculating

My lecturer has said that we do need to check our program and avoid from entering overflow calculating of looping..I really don't get it..what does it mean?
If someone knows about it, please feel free to share any words.

What does it mean by int should have between - 2^16 to 2^16-1.

What are unsigned integers for? What is the max number for unsigned int then?

Any help would be really much appreciated.
Thank you for any help ..
May 24 '07 #1
5 1573
r035198x
13,262 8TB
My lecturer has said that we do need to check our program and avoid from entering overflow calculating of looping..I really don't get it..what does it mean?
If someone knows about it, please feel free to share any words.

What does it mean by int should have between - 2^16 to 2^16-1.

What are unsigned integers for? What is the max number for unsigned int then?

Any help would be really much appreciated.
Thank you for any help ..
Go through this page. Type determines the size of memory reserved for a variable. Some types require more memory than others.
Sign just refers to - and + signs
May 24 '07 #2
Go through this page. Type determines the size of memory reserved for a variable. Some types require more memory than others.
Sign just refers to - and + signs
Thank you...
May I ask one more question? It's not regarding java type...
Regarding ranking - which we do need to use java to sort and give rank to our data. I give one example and please correct if I'm wrong:

name : grade : rank
jonny A 1
jane B 2
jade A 1
jedy C 4
june D 5
jelly B 2
May 24 '07 #3
JosAH
11,448 Expert 8TB
Thank you...
May I ask one more question? It's not regarding java type...
Regarding ranking - which we do need to use java to sort and give rank to our data. I give one example and please correct if I'm wrong:

name : grade : rank
jonny A 1
jane B 2
jade A 1
jedy C 4
june D 5
jelly B 2
There's a strict functional relationship between the grades and the ranks:
A == 1, B == 2, C == 4, ... D == 5. Given the grade letter, the rank can
be easily found: read the API docs for the String class and it won't come
as a surprise that the following little method can do the job:
Expand|Select|Wrap|Line Numbers
  1. int getRank(char grade) {
  2.    if (grade == '*') return -1;
  3.    return "*AB*CD".indexOf(grade);
  4. }
Read the API docs and study the method used in this snippet.

kind regards,

Jos
May 24 '07 #4
There's a strict functional relationship between the grades and the ranks:
A == 1, B == 2, C == 4, ... D == 5. Given the grade letter, the rank can
be easily found: read the API docs for the String class and it won't come
as a surprise that the following little method can do the job:
Expand|Select|Wrap|Line Numbers
  1. int getRank(char grade) {
  2.    if (grade == '*') return -1;
  3.    return "*AB*CD".indexOf(grade);
  4. }
Read the API docs and study the method used in this snippet.

kind regards,

Jos
how the if the case is not grades, but numbers? e.g: there are
10, 15, 17, 90, 2, 55 (some numbers are the same)
What shall I do? Do I have to sort them in ascending order then
which method we need to use? Thank you
May 24 '07 #5
JosAH
11,448 Expert 8TB
how the if the case is not grades, but numbers? e.g: there are
10, 15, 17, 90, 2, 55 (some numbers are the same)
What shall I do? Do I have to sort them in ascending order then
which method we need to use? Thank you
In the general case my little trick doesn't apply of course. Have a look at the
several sort methods available in the Collections and Arrays utility classes.

kind regards,

Jos
May 24 '07 #6

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

Similar topics

10
by: tomb | last post by:
Please help! I have a handler in a class that handles when a column in a table is modified, as such: dtWhatif = dsOp.Tables("whatif") AddHandler dtWhatif.ColumnChanged, New...
8
by: starffly | last post by:
In my program, the caculated value is supposed to be no more than the constant named MAXINT,otherwise, overflow error will be informed.however, I cannot test if the value exceeds MAXINT within the...
2
by: kaczmar2 | last post by:
I have a webpage that has 2 main DIVs - a title div and a content div. I want the title dive to always "stick to the top of the page and not scroll, regardless of the size of the window. The...
17
by: Tarique | last post by:
This program was compiled on MS Visual C++ 08 /*Fibonacci Numbers*/ #include<stdio.h> #include<limits.h> void fibonacci(int n) { unsigned long long fib0 = 0; /*First Fibonacci Number*/
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
0
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,...

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.