FC Jamison 31 Posting Pro in Training Team Colleague

I'm assuming this is an assignment in a beginning programming course. As such, I would look at this problem as a series if nested if statements.

Pseudocode is kind of like writing down programming logic without worrying about syntax. So for this exercise you don't have to know how to write an if...else if...else block of code in whatever language you are learning, you just have to recognize what it is and write it out in a sort of english-coding hybrid sort of way.

For this, what is your top level of items? It is age. So you start out

`if age < 55
        do stuff

    else if age >= 55 and age < 80
        do different stuff

    else
        do other stuff`

Then you look at what the next level of the first if statement is using. Here, it is gender. So now you want to add a second level of if statements.

if age < 55
        if gender=male
                do this
        else
                do that

    else if age >= 55 and age < 80
        do different stuff

    else
            do other stuff

Then look at the third level distinction. This is income level. So you add this step in like so

    if age < 55
            if gender=male
                    if annual income >= 10,000 and annual income <= 50,000
                            tax = 10%
                    else if annual income > 50,000 and annual income <= 100,000
                            tax = 20%
                    else if annual income > 100,000
                            tax = 30%
            else
                    do that

        else if age >= 55 …
FC Jamison 31 Posting Pro in Training Team Colleague

I won't write your code, because like others have said, iy is not our place to do your homework for you.

I will, however, give you some psedocode to point you in the right direction. I believe that it is the goal of a forum such as this to provide help to people learning how to code. Psuedocode will tell you what to do, but not how to do it. That will require a little research on your part.

I will start with the assumption that you have an array of integers, and that they are pre-sorted.

    Find the length of the array

    If the length of the array / 2 leaves a remainder of 1
        get the contents of index [(length + 1) / 2]

    else
        get the contents of index [length / 2]
        get the contents of index [(length / 2) + 1]
        add the two numbers together
        divide the result by 2 using floating point division

    Display the result

You need to research how to find the length of an array in Java
You need to research how to do floating point division vs. integer division
You need to research the best type of variable to store your answer in
You need to research how to display data using one of Java's print methods

JamesCherrill commented: Good judgement on how much help to give +15
FC Jamison 31 Posting Pro in Training Team Colleague

How would I write a C++ class of which only one can be created ever be instantiated in any program.

I know that

ClassName* objectName = new ClassName();

instantiates an object, but how would I make it so when you try to instantiate it more than once you still end up with a reference to the first instance?

Even if you could point me to a reference where I can read how this might be done I would greatly appreciate it.

FC Jamison 31 Posting Pro in Training Team Colleague
<link href="../style.css" rel="stylesheet" type="text/css" />
FC Jamison 31 Posting Pro in Training Team Colleague

Hmm...I have never noticed this problem...but I have high speed DSL. Are you sure there is not an onload function floating aruond in there somewhere that tells the browser to wait until the page is loaded to process the menu script?

Mike555 commented: -mike555 +1
FC Jamison 31 Posting Pro in Training Team Colleague

Could he use something like

static_cast<int>(string[0]) - 48
FC Jamison 31 Posting Pro in Training Team Colleague

True...the data types and sizes shown are typical on Windows systems, and the sizes and ranges may be different on other operating systems...

You can determine the size of an integer using sizeof(int); .

Still...my explanation is the most plausable...he has simply exceeded to range of an int.

FC Jamison 31 Posting Pro in Training Team Colleague

This is because of the size limitations of data types.

an int is only 4 bytes...and has a range from -2,147,483,648 to 2,147,483,647

A double uses 8 bytes (and some floating point algorithm that is beyond my comprehension at the moment) and has a range from +/-1.7E-308 to +/-1.7E308.

Your number simply went out of the range of an integer.

Interestingly enough...integers will simply loop through thaie cycle...i.e. if the number is larger than 2,147,483,647 it will restart the count at -2,147,483,648...whild doubles that exceed their upper limit will cause an error.

FC Jamison 31 Posting Pro in Training Team Colleague

I did this a month or so back for a client.

It will at least give you an idea of how to use an array to populate a table.

hgltd commented: helpful +1
FC Jamison 31 Posting Pro in Training Team Colleague

If you must use a double...for whatever reason...you can use

if (loanYears - static_cast<int>(loanYears) != 0)
FC Jamison 31 Posting Pro in Training Team Colleague

Ah..I just saw the bottom part...the minute hour thing is kind of tricky

convert your start and end time to minutes...so that all of your calculations are done in minutes...

the final step would be to convert the minutes back into an hour:minute format

so hours would be calculated by

int hours = newTime / 60
int minutes = newTime % 60

and your time output would be

cout << hours << ":" << munutes;

FC Jamison 31 Posting Pro in Training Team Colleague

Logically...you have a start time and an end time stored in variables.

create a third variable to hold the total time (start time - end time)

multiply the total time by 0.75 (totalTime*0.75) and store it in a new variable

add the calculated time to the start time

mathematically...

((end time - start time) * 0.75) + start time

FC Jamison 31 Posting Pro in Training Team Colleague

Here is the definition of algorithm...

http://en.wikipedia.org/wiki/Algorithm

FC Jamison 31 Posting Pro in Training Team Colleague

Here's the big glaring error I see in your code...

string string;

You can't use "string" as a variable name.

FC Jamison 31 Posting Pro in Training Team Colleague

Ha.! I remember my C++ instructor promising not to give us a bad grade on an assignment if we promised not to use global variables...lol

FC Jamison 31 Posting Pro in Training Team Colleague

You understood that, Salem?

FC Jamison 31 Posting Pro in Training Team Colleague

If you install the wrong codecs...some funky things can happen.

I would try uninstalling the codecs and seeing if I could play a video I know to be safe...if that doesn't work, and you have your Windows XP CD...try uninstalling and reinstalling the media player.

If that still doesn't work...you might have a hardware issue.

FC Jamison 31 Posting Pro in Training Team Colleague

I found the problem...

You have

<p class=bullets11bldblck align=center>
  <br>
  <noscript>
    <object codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0  height=185 width=300 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000>
      <param name="movie" value="Resources/HollandRoll.swf">
      <param name="quality" value="high">
      <embed src="Resources/HollandRoll.swf" quality="high"  pluginspage="http://www.macromedia.com/go/getflashplayer"  type="application/x-shockwave-flash" width="300"  height="185">
      </embed>
    </object>
    </OBJECT>
  </noscript>
</p>

You need to remove the noscript tags and that extra closing object tag.

<p class=bullets11bldblck align=center>
  <br>
  <object codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0  height=185 width=300 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000>
    <param name="movie" value="Resources/HollandRoll.swf">
    <param name="quality" value="high">
    <embed src="Resources/HollandRoll.swf" quality="high"  pluginspage="http://www.macromedia.com/go/getflashplayer"  type="application/x-shockwave-flash" width="300"  height="185">
    </embed>
  </object>
</p>
denise@imm commented: I so appreciate DJs help. I was really stuck and he came back and kept looking at this with me. I'm thrilled with the help. +1
FC Jamison 31 Posting Pro in Training Team Colleague

This will set the height of your div to the height of the browser window:
NOTE: 'divID' is the id name of the div in the html document.

window.onload = setDiv;

function setDiv() {
  var wh = getWindowHeight(); // Window Height
  var d = document.getElementById('divID') // Get div element
  var dh = d.offsetHeight // div height
  d.style.height = wh + 'px'; // Set div height to window height
}




function getWindowHeight() {
  var windowHeight = 0;
	
  if (typeof(window.innerHeight) == 'number')
    windowHeight = window.innerHeight;
	
  else {
		
    if (document.documentElement && document.documentElement.clientHeight)
      windowHeight = document.documentElement.clientHeight;
		
    else {
      if (document.body && document.body.clientHeight)
        windowHeight = document.body.clientHeight; }; };
				
  return windowHeight;
};
Sailor_Jerry commented: Good Stuff! +1
FC Jamison 31 Posting Pro in Training Team Colleague

Well crap...that only works in IE.

The latest Netscape and FireFox browsers won't let javascript close a window it did not open.

FC Jamison 31 Posting Pro in Training Team Colleague

This code is used specifically to redirect one Web page to another (i.e. if your Web site has moved, put this code at the old location)

<html>
  <head>
    <title>Redirect JavaScript-browsers</title>

    <script language="JavaScript">
      <!-- Beginning of JavaScript --------
        this.location = "http://www.newsite.com";
      // -- End of JavaScript code -------------- -->
    </script>

  </head>

  <body>
    This site is now located at <a href="http://www.newsite.com">http://www.newsite.com</a>.
  </body>
</html>

I hope that helps you out.

Mushy-pea commented: Very helpfull. +1