answersLogoWhite

0


Best Answer

In my own personal opinion the switch statement is easier to understand and to add newer cases to without disturbing the logic.

In some compilers the switch statement may generate better machine code because the switch is actually wired into the hardware.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

If you're new here, you may want to subscribe to our E-mail Digest or RSS Feed. We will then send you the stories that are posted each day in an e-mail digest. We use a service called Feedburner for delivery of these emails. You will receive an e-mail from Feedburner after you subscribe and you must click on that email to activate your subscription. Thanks for visiting and enjoy all the information!

RV.Net Blog Admin

Ok, so my own coach does not have IFS and runs with a solid axle. But when my coach was built there were no chassis out there for a diesel pusher with independent front suspension. And it is true that when I bought this coach I down traded from a later model Southwind on a Chevrolet P-30 with IFS to an older Foretravel on a solid front axle Oshkosh chassis. But more on that in a minute.

In general the IFS suspension has so many advantages over the solid axle that the decision to go IFS should be a no brainer. Lets look at the differences. In a solid axle set up when one wheel goes over a bump and that wheel rises it lifts that end of the axle. If the other wheel remains on flat ground the tipping up of one end of the axle causes the wheel on the other end to tip out at the top. Now the center line through the wheel will no longer be parallel to the ground but will tip down and intersect with the ground somewhere out to the side. That wheel will not steer around that intersecting point and no longer roll straight ahead. This is called bump steer that the driver must correct for. Independent front suspensions are free of bump steer.

The engineer in designing the length of the suspension arms and placement of the pivot points can correct for a variety of handling problems. Roll center, or how the rig leans on turns, dive which is the nose down effect of hard braking are but two handing problems that can be controlled.

And finally alignment. While there are a few alignment angles that can be changed on the solid axle like camber, but the work involved in bending the heavy axle to make the adjustments is a bear. Caster is adjusted by adding tapered shims between the springs and the axle, but this effects both sides of the vehicle. Each wheel if the independent rigs can be adjusted six ways to Sunday for handling, ride and tire wear.

The down side of IFS is complexity. There are many more wear points on IFS than a solid front axle. The steering linkage is more complex and must have pivot points that match the geometry of the suspension. And as all of us who owned and drove the P-30 Chevy chassis rigs the original engineering can make or break the handling of the rig.

The old P-30's had as a major fault a narrow front end. The front wheels were closer together than the rear wheels. The newer IFS rigs moved the front wheels out to the same tread width as the outside rear dual tires. This helped improve the ride and handling, especially in the front engine rigs.

There are two designs IFS on the market for the DP rigs right now. Dana builds a unit that is found under the Freightliner chassis that is equipped with ball joints, just like your car. Other makers use a king pin system that has more wear points that the ball joint system. Add to all this the decrease in turning radius that can easily be achieved with IFS, the system appears to have created a strong foothold in the industry.

Well now that we have beaten this dead horse, come on back next Monday to see what we talk about next. And don't forget to let me know if you agree or disagree with my thoughts.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the advantage of switch over multiple IF Statement?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What advantage does Java's break statement have over C's break statement?

They do the same thing, but only the former can be used in a Java program.


What is the syntax and purpose of the switch statement in c plus plus?

The purpose of a switch statement is to execute one of several sections of code, depending on the value of an integral expression. The syntax of a switch statement can be stated as follows: switch(expression) { case(constant_expression_1): statement case(constant_expression_2): statement //.. case(constant_expression_n): statement [default: statement] } The ellipses around the constant expressions are optional and may be omitted. The switch statement body consists of one or more case labels and an optional default label (the case labels are also optional, but a switch statement would be meaningless without them). The default statement, if present, need not be the final label in a switch statement. Case and default labels may not appear outside of a switch statement, as they are not treated the same as goto labels. The constant_expression in each case label is converted to the type of the switch expression and is compared with the switch expression for equality. Control is immediately passed to the labelled statement whose constant_expression matches the value of the switch expression. Once a label gains control, execution proceeds from that point on and is not impeded by any subsequent case or default labels. However, a break statement may be used to interrupt execution at any time, which will transfer control to the statement immediately following the switch statement body. You may also use a return statement to return control to the calling function, or a goto statement. However, note that while a goto label is not the same as a case label, you may use goto labels inside a switch statement if required. Here's an example demonstrating how code flows through a switch statement: int x; switch(x=rand()%10) // x is a random number in the range 0 to 9. { case(0): x=42; break; case(1): case(2): x=33; break; case(3): x=100; default: x=0; } If x were 0, then execution passes to case(0) where the value 42 is assigned to x and the switch exits. If x were 1 or 2, then 33 is assigned to x and the switch exits. If x were 3, 100 is assigned to x. In all other cases, 0 is assigned to x. You will note that when the switch statement ends, x can only ever be 42, 33 or 0. Why not 100? Look again and you will see that case(3) has no break statement (just as case(1) has no break statement). So although 100 is assigned to x in case(3), the default case immediately assigns 0 to x. This is not a particularly useful switch statement, but it serves to demonstrate how code flows through a switch statement, and how forgetting to put a break statement at the end of a case can cause unexpected errors to creep into your code. While you could emulate the same results using a series of if, else if and else statements, the benefit of a switch statement is that it will generally simplify the complexity of your code, because there is only one expression to evaluate, rather than a series of boolean expressions. Your compiler will generate machine code just as if you'd used a series of if statements, but the switch statement gives a greater sense of structure to the statement, and gives a greater degree of control over which section(s) of code will execute for any given evaluation. And just as ifs can be nested within other ifs, switch statements can be nested within other switch statements. Note that all code in a switch statement must be reachable (that is, not bypassed by all execution paths). For instance the following contains both unreachable and undefined code: switch(x) { x=42; //unreachable case(100): int y=42; break; default: x=y; // y is undefined } The line x=42 cannot be reached because execution must either pass to either the case(100) or the default label. Similarly, the x=y line is invalid because y is defined within the case(100) label, which is not reachable from within the default label due to the break statement.


Advantages of switch - case over if else?

1.Switch statement looks a lot more tidy and easy to read and understand. 2.Here multiple statements need not to be enclosed within a pair of braces. 3.Switch statement executes faster than if_else because the switch statement checks the condition first and then jumps to the suitable case statement.


If then else statements and case statements essentially perform the same function when would you use one over the other?

I would recommend an If - then - else statement over a switch statement because:1. It is simpler/easier2. You do not get unexpected output because of missing break statementsA missed break statement in one of the conditions in a switch case statement means that all the conditions that come after the success condition are executed. In case of if else this is not the case and hence it is much safer for novice programmers.> essentially perform the same functionNo, they don't. Here is an example to prove this:if (sin (alpha) > cos (alpha)) {...} else if (alpha / M_PI * 180 > 180) {...} else {...}


What is advantage of capacitor filter over RC filter?

sounds same to me.maybe you meant advantage of LC filter over RC filter

Related questions

Advantage of multiple control remote switch?

If you have two switches connected to a light in a room.example your bed room and you are in your bed you wont have to get out of your bed to switch off the light but u can switch it off by pulling a switch over your head.


What advantage does Java's break statement have over C's break statement?

They do the same thing, but only the former can be used in a Java program.


What the advantages and disadvantages of bridges and switches?

well an advantage for the bridge is u get over water instead of running into a river. and an advantage for a switch is u can turn stuff on and off.


What is advantage of push button over toggle switch?

One of the main advantages of a push button over a toggle switch is there is less room for accidental engagements. A toggle switch can easily be turned on or off by accident and a push button has to be intentionally touched to turn it on or off.


What advantage does the current definiton of the meter have over the 1793 statement?

I have no idea! Answer it yourself you bafoon!Go to googleType your questionbe all girly happy


What is one advantage a secondary source has over a primary source?

A secondary source summarizes complex subjects by synthesizing multiple sources.


What is the advantage of switch statement over else-if construct?

An if-else statement can only evaluate boolean expressions. That is, an expression can only evaluate true or false which means only one of the two possible execution paths will be executed for each if statement encountered. At every if statement, the control expression must be evaluated. A switch statement can have as many execution paths as there are evaluations of a single expression. The switch expression must evaluate to an integral type (an integer or enumeration). Each execution point is represented by a case label that matches the result of the evaluation. An optional default label can be used as the execution point for any evaluations that do not have their own case labels. The default label need not be the last label. Case labels are no different to ordinary code labels; execution will continue through each and every case label until the end of the switch statement is reached or a break statement is encountered en route. This allows us to create more complex execution paths that operate more efficiently than would be possible with a series of if-else statements.


What is the advantage of using dedicated servers?

Having a dedicated server for a website means the site is the only one hosted on that device. The advantage of this is improved stability, since the computer doesn't have to divide its resources over multiple websites.


What is the syntax and purpose of the switch statement in c plus plus?

The purpose of a switch statement is to execute one of several sections of code, depending on the value of an integral expression. The syntax of a switch statement can be stated as follows: switch(expression) { case(constant_expression_1): statement case(constant_expression_2): statement //.. case(constant_expression_n): statement [default: statement] } The ellipses around the constant expressions are optional and may be omitted. The switch statement body consists of one or more case labels and an optional default label (the case labels are also optional, but a switch statement would be meaningless without them). The default statement, if present, need not be the final label in a switch statement. Case and default labels may not appear outside of a switch statement, as they are not treated the same as goto labels. The constant_expression in each case label is converted to the type of the switch expression and is compared with the switch expression for equality. Control is immediately passed to the labelled statement whose constant_expression matches the value of the switch expression. Once a label gains control, execution proceeds from that point on and is not impeded by any subsequent case or default labels. However, a break statement may be used to interrupt execution at any time, which will transfer control to the statement immediately following the switch statement body. You may also use a return statement to return control to the calling function, or a goto statement. However, note that while a goto label is not the same as a case label, you may use goto labels inside a switch statement if required. Here's an example demonstrating how code flows through a switch statement: int x; switch(x=rand()%10) // x is a random number in the range 0 to 9. { case(0): x=42; break; case(1): case(2): x=33; break; case(3): x=100; default: x=0; } If x were 0, then execution passes to case(0) where the value 42 is assigned to x and the switch exits. If x were 1 or 2, then 33 is assigned to x and the switch exits. If x were 3, 100 is assigned to x. In all other cases, 0 is assigned to x. You will note that when the switch statement ends, x can only ever be 42, 33 or 0. Why not 100? Look again and you will see that case(3) has no break statement (just as case(1) has no break statement). So although 100 is assigned to x in case(3), the default case immediately assigns 0 to x. This is not a particularly useful switch statement, but it serves to demonstrate how code flows through a switch statement, and how forgetting to put a break statement at the end of a case can cause unexpected errors to creep into your code. While you could emulate the same results using a series of if, else if and else statements, the benefit of a switch statement is that it will generally simplify the complexity of your code, because there is only one expression to evaluate, rather than a series of boolean expressions. Your compiler will generate machine code just as if you'd used a series of if statements, but the switch statement gives a greater sense of structure to the statement, and gives a greater degree of control over which section(s) of code will execute for any given evaluation. And just as ifs can be nested within other ifs, switch statements can be nested within other switch statements. Note that all code in a switch statement must be reachable (that is, not bypassed by all execution paths). For instance the following contains both unreachable and undefined code: switch(x) { x=42; //unreachable case(100): int y=42; break; default: x=y; // y is undefined } The line x=42 cannot be reached because execution must either pass to either the case(100) or the default label. Similarly, the x=y line is invalid because y is defined within the case(100) label, which is not reachable from within the default label due to the break statement.


The main advantage of ECL over TTL?

The main advantage of ECL over TTL is speed.


What advantage does standard form have over scientific notation?

It has no advantage.


Advantages of switch - case over if else?

1.Switch statement looks a lot more tidy and easy to read and understand. 2.Here multiple statements need not to be enclosed within a pair of braces. 3.Switch statement executes faster than if_else because the switch statement checks the condition first and then jumps to the suitable case statement.