Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: Blue Pelican Java- Array of Hope; char array for loops?

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Blue Pelican Java- Array of Hope; char array for loops?

    The assignment is:

    This project called ArrayOfHope will consist of just one class, Tester, that in turn, has just one
    method, main. The main method will use two for-loops:
    • The first loop will produce an integer count from 65 to 90 (notice these are the ASCII
    codes for characters A…Z) and initialize the elements of the character array ch[ ] with
    the characters corresponding to the ASCII codes being generated by the loop. This will
    fill the ch[ ] array as follows: ch[0] = ‘A’, ch[1] = ‘B’, …, ch[25] = ‘Z’.
    • The second loop will print the 26 elements of the ch[ ] array with one comma followed
    by one space between adjacent characters as follows:
    A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z

    and so far I've got:



    public class Tester
    {
    public static void main (String args[])
    {
    char ch [] = {65, 66, 67, 68, 69, 70, 71, 72,73,74 ,75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90};

    for (int i = 0; i < ch.length; i++)
    {
    System.out.println(ch[i]);
    }

    for (int j = 0; j< ch.length; j++)
    {

    }

    }
    }


    I think I'm going about it in the wrong way, and I'm stuck. Can someone help me please?[


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Blue Pelican Java- Array of Hope; char array for loops?

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for newcomers. Please correct your post.

    Also, describe why you think you're doing it the wrong way and why you think you're stuck. What results are you getting? What should be different? What do you think needs to be done to correct it? Ask specific questions.

  3. #3
    Member andbin's Avatar
    Join Date
    Dec 2013
    Location
    Italy
    Posts
    443
    Thanks
    4
    Thanked 122 Times in 114 Posts

    Default Re: Blue Pelican Java- Array of Hope; char array for loops?

    Quote Originally Posted by Draco579 View Post
    initialize the elements of the character array ch[ ] with the characters corresponding to the ASCII codes being generated by the loop
    Think: have you done this kind of initialization? You have done an initialization but with "cabled" values, not with calculated/derived values.

    Quote Originally Posted by Draco579 View Post
    • The second loop will print the 26 elements of the ch[ ] array with one comma followed
    by one space between adjacent characters as follows:
    A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z
    You have done a loop to print the values, but the output is not that requested.
    Andrea, www.andbin.netSCJP 5 (91%) – SCWCD 5 (94%)

    Useful links for Java beginnersMy new project Java Examples on Google Code

  4. #4
    Junior Member ZaneDarklace's Avatar
    Join Date
    Feb 2014
    Location
    Lawton, OK
    Posts
    15
    My Mood
    Lonely
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: Blue Pelican Java- Array of Hope; char array for loops?

    I just finished this project. i used this code and it worked beautifully.

    ....
    Last edited by copeg; February 19th, 2014 at 11:27 AM. Reason: removed spoonfeeding
    Rock On

  5. #5
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Blue Pelican Java- Array of Hope; char array for loops?

    @Zane, welcome to the forums. Please read Announcements - What's Wrong With My Code? (particularly point 7) and http://www.javaprogrammingforums.com...n-feeding.html.

  6. #6
    Junior Member ZaneDarklace's Avatar
    Join Date
    Feb 2014
    Location
    Lawton, OK
    Posts
    15
    My Mood
    Lonely
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: Blue Pelican Java- Array of Hope; char array for loops?

    My apologies. I must have skipped over that. thank you
    Rock On

  7. #7
    Junior Member
    Join Date
    Nov 2017
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Blue Pelican Java- Array of Hope; char array for loops?

    First, let's get a little historical perspective on American health care. This is not intended to be an exhausted look into that history but it will give us an appreciation of how the health care system and our expectations for it developed. What drove costs higher and higher?

    To begin, let's turn to the American civil war. In that war, dated tactics and the carnage inflicted by modern weapons of the era combined to cause ghastly results. Not generally known is that most of the deaths on both sides of that war were not the result of actual combat but to what happened after a battlefield wound was inflicted. To begin with, evacuation of the wounded moved at a snail's pace and this caused severe delays in treating the wounded. Secondly, many wounds were subjected to wound care, related surgeries and/or amputations of the affected limbs and this often resulted in the onset of massive infection. So you might survive a battle wound only to die at the hands of medical care providers who although well-intentioned, their interventions were often quite lethal. High death tolls can also be ascribed to everyday sicknesses and diseases in a time when no antibiotics existed. In total something like 600,000 deaths occurred from all causes, over 2% of the U.S. population at the time!

    Let's skip to the first half of the 20th century for some additional perspective and to bring us up to more modern times. After the civil war there were steady improvements in American medicine in both the understanding and treatment of certain diseases, new surgical techniques and in physician education and training. But for the most part the best that doctors could offer their patients was a "wait and see" approach. Medicine could handle bone fractures and increasingly attempt risky surgeries (now largely performed in sterile surgical environments) but medicines were not yet available to handle serious illnesses. The majority of deaths remained the result of untreatable conditions such as tuberculosis, pneumonia, scarlet fever and measles and/or related complications. Doctors were increasingly aware of heart and vascular conditions, and cancer but they had almost nothing with which to treat these conditions.

    This very basic review of American medical history helps us to understand that until quite recently (around the 1950's) we had virtually no technologies with which to treat serious or even minor ailments. Here is a critical point we need to understand; "nothing to treat you with means that visits to the doctor if at all were relegated to emergencies so in such a scenario costs are curtailed. The simple fact is that there was little for doctors to offer and therefore virtually nothing to drive health care spending. A second factor holding down costs was that medical treatments that were provided were paid for out-of-pocket, meaning by way of an individuals personal resources. There was no such thing as health insurance and certainly not health insurance paid by an employer. Except for the very destitute who were lucky to find their way into a charity hospital, health care costs were the responsibility of the individual.

    What does health care insurance have to do with health care costs? Its impact on health care costs has been, and remains to this day, absolutely enormous. When health insurance for individuals and families emerged as a means for corporations to escape wage freezes and to attract and retain employees after World War II, almost overnight a great pool of money became available to pay for health care. Money, as a result of the availability of billions of dollars from health insurance pools, encouraged an innovative America to increase medical research efforts. More Americans became insured not only through private, employer sponsored health insurance but through increased government funding that created Medicare and Medicaid (1965). In addition funding became available for expanded veterans health care benefits. Finding a cure for almost anything has consequently become very lucrative. This is also the primary reason for the vast array of treatments we have available today.

    I do not wish to convey that medical innovations are a bad thing. Think of the tens of millions of lives that have been saved, extended, enhanced and made more productive as a result. But with a funding source grown to its current magnitude (hundreds of billions of dollars annually) upward pressure on health care costs are inevitable. Doctor's offer and most of us demand and get access to the latest available health care technology in the form of pharmaceuticals, medical devices, diagnostic tools and surgical procedures. So the result is that there is more health care to spend our money on and until very recently most of us were insured and the costs were largely covered by a third-party (government, employers). Add an insatiable and unrealistic public demand for access and treatment and we have the "perfect storm" for higher and higher health care costs. And by and large the storm is only intensifying.

    At this point, let's turn to the key questions that will lead us into a review and hopefully a better understanding of the health care reform proposals in the news today. Is the current trajectory of U.S. health care spending sustainable? Can America maintain its world competitiveness when 16%, heading for 20% of our gross national product is being spent on health care? What are the other industrialized countries spending on health care and is it even close to these numbers? When we add politics and an election year to the debate, information to help us answer these questions become critical. We need to spend some effort in understanding health care and sorting out how we think about it. Properly armed we can more intelligently determine whether certain health care proposals might solve or worsen some of these problems. What can be done about the challenges? How can we as individuals contribute to the solutions?

    The Obama health care plan is complex for sure - I have never seen a health care plan that isn't. But through a variety of programs his plan attempts to deal with a) increasing the number of American that are covered by adequate insurance (almost 50 million are not), and b) managing costs in such a manner that quality and our access to health care is not adversely affected. Republicans seek to achieve these same basic and broad goals, but their approach is proposed as being more market driven than government driven. Let's look at what the Obama plan does to accomplish the two objectives above. Remember, by the way, that his plan was passed by congress, and begins to seriously kick-in starting in 2014. So this is the direction we are currently taking as we attempt to reform health care.


    Through insurance exchanges and an expansion of Medicaid,the Obama plan dramatically expands the number of Americans that will be covered by health insurance.


    To cover the cost of this expansion the plan requires everyone to have health insurance with a penalty to be paid if we don't comply. It will purportedly send money to the states to cover those individuals added to state-based Medicaid programs.


    To cover the added costs there were a number of new taxes introduced, one being a 2.5% tax on new medical technologies and another increases taxes on interest and dividend income for wealthier Americans.


    The Obama plan also uses concepts such as evidence-based medicine, accountable care organizations, comparative effectiveness research and reduced reimbursement to health care providers (doctors and hospitals) to control costs.


    The insurance mandate covered by points 1 and 2 above is a worthy goal and most industrialized countries outside of the U.S. provide "free" (paid for by rather high individual and corporate taxes) health care to most if not all of their citizens. It is important to note, however, that there are a number of restrictions for which many Americans would be culturally unprepared. Here is the primary controversial aspect of the Obama plan, the insurance mandate. The U.S. Supreme Court recently decided to hear arguments as to the constitutionality of the health insurance mandate as a result of a petition by 26 states attorney's general that congress exceeded its authority under the commerce clause of the U.S. constitution by passing this element of the plan. The problem is that if the Supreme Court should rule against the mandate, it is generally believed that the Obama plan as we know it is doomed. This is because its major goal of providing health insurance to all would be severely limited if not terminated altogether by such a decision.

    As you would guess, the taxes covered by point 3 above are rather unpopular with those entities and individuals that have to pay them. Medical device companies, pharmaceutical companies, hospitals, doctors and insurance companies all had to "give up" something that would either create new revenue or would reduce costs within their spheres of control. As an example, Stryker Corporation, a large medical device company, recently announced at least a 1,000 employee reduction in part to cover these new fees. This is being experienced by other medical device companies and pharmaceutical companies as well. The reduction in good paying jobs in these sectors and in the hospital sector may rise as former cost structures will have to be dealt with in order to accommodate the reduced rate of reimbursement to hospitals. Over the next ten years some estimates put the cost reductions to hospitals and physicians at half a trillion dollars and this will flow directly to and affect the companies that supply hospitals and doctors with the latest medical technologies. None of this is to say that efficiencies will not be realized by these changes or that other jobs will in turn be created but this will represent painful change for a while. It helps us to understand that health care reform does have an effect both positive and negative.

    Finally, the Obama plan seeks to change the way medical decisions are made. While clinical and basic research underpins almost everything done in medicine today, doctors are creatures of habit like the rest of us and their training and day-to-day experiences dictate to a great extent how they go about diagnosing and treating our conditions. Enter the concept of evidence-based medicine and comparative effectiveness research. Both of these seek to develop and utilize data bases from electronic health records and other sources to give better and more timely information and feedback to physicians as to the outcomes and costs of the treatments they are providing. There is great waste in health care today, estimated at perhaps a third of an over 2 trillion dollar health care spend annually. Imagine the savings that are possible from a reduction in unnecessary test and procedures that do not compare favorably with health care interventions that are better documented as effective. Now the Republicans and others don't generally like these ideas as they tend to characterize them as "big government control" of your and my health care. But to be fair, regardless of their political persuasions, most people who understand health care at all, know that better data for the purposes described above will be crucial to getting health care efficiencies, patient safety and costs headed in the right direction.

    A brief review of how Republicans and more conservative individuals think about health care reform. I believe they would agree that costs must come under control and that more, not fewer Americans should have access to health care regardless of their ability to pay. But the main difference is that these folks see market forces and competition as the way to creating the cost reductions and efficiencies we need. There are a number of ideas with regard to driving more competition among health insurance companies and health care providers (doctors and hospitals) so that the consumer would begin to drive cost down by the choices we make. This works in many sectors of our economy but this formula has shown that improvements are illusive when applied to health care. Primarily the problem is that health care choices are difficult even for those who understand it and are connected. The general population, however, is not so informed and besides we have all been brought up to "go to the doctor" when we feel it is necessary and we also have a cultural heritage that has engendered within most of us the feeling that health care is something that is just there and there really isn't any reason not to access it for whatever the reason and worse we all feel that there is nothing we can do to affect its costs to insure its availability to those with serious problems.

    OK, this article was not intended to be an exhaustive study as I needed to keep it short in an attempt to hold my audience's attention and to leave some room for discussing what we can do contribute mightily to solving some of the problems. First we must understand that the dollars available for health care are not limitless. Any changes that are put in place to provide better insurance coverage and access to care will cost more. And somehow we have to find the revenues to pay for these changes. At the same time we have to pay less for medical treatments and procedures and do something to restrict the availability of unproven or poorly documented treatments as we are the highest cost health care system in the world and don't necessarily have the best results in terms of longevity or avoiding chronic diseases much earlier than necessary.

    I believe that we need a revolutionary change in the way we think about health care, its availability, its costs and who pays for it. And if you think I am about to say we should arbitrarily and drastically reduce spending on health care you would be wrong. Here it is fellow citizens - health care spending needs to be preserved and protected for those who need it. And to free up these dollars those of us who don't need it or can delay it or avoid it need to act. First, we need to convince our politicians that this country needs sustained public education with regard to the value of preventive health strategies. This should be a top priority and it has worked to reduce the number of U.S. smokers for example. If prevention were to take hold, it is reasonable to assume that those needing health care for the myriad of life style engendered chronic diseases would decrease dramatically. Millions of Americans are experiencing these diseases far earlier than in decades past and much of this is due to poor life style choices. This change alone would free up plenty of money to handle the health care costs of those in dire need of treatment, whether due to an acute emergency or chronic condition.

    Let's go deeper on the first issue. Most of us refuse do something about implementing basic wellness strategies into our daily lives. We don't exercise but we offer a lot of excuses. We don't eat right but we offer a lot of excuses. We smoke and/or we drink alcohol to excess and we offer a lot of excuses as to why we can't do anything about managing these known to be destructive personal health habits. We don't take advantage of preventive health check-ups that look at blood pressure, cholesterol readings and body weight but we offer a lot of excuses. In short we neglect these things and the result is that we succumb much earlier than necessary to chronic diseases like heart problems, diabetes and high blood pressure. We wind up accessing doctors for these and more routine matters because "health care is there" and somehow we think we have no responsibility for reducing our demand on it.

    It is difficult for us to listen to these truths but easy to blame the sick. Maybe they should take better care of themselves! Well, that might be true or maybe they have a genetic condition and they have become among the unfortunate through absolutely no fault of their own. But the point is that you and I can implement personalized preventive disease measures as a way of dramatically improving health care access for others while reducing its costs. It is far better to be productive by doing something we can control then shifting the blame.

    There are a huge number of free web sites available that can steer us to a more healthful life style. A soon as you can, "Google" "preventive health care strategies", look up your local hospital's web site and you will find more than enough help to get you started. Finally, there is a lot to think about here and I have tried to outline the challenges but also the very powerful effect we could have on preserving the best of America's health care system now and into the future. I am anxious to hear from you and until then - take charge and increase your chances for good health while making sure that health care is there when we need it.

Similar Threads

  1. Char array to a String array with hex
    By fortune2k in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 20th, 2014, 01:01 PM
  2. Help with java char Array
    By ashboi in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 9th, 2012, 10:46 AM
  3. How do I compare between the array of char and array of words !!?
    By bady2050 in forum Collections and Generics
    Replies: 1
    Last Post: May 5th, 2012, 05:36 PM
  4. [SOLVED] Char Array Increment + 1
    By Nuggets in forum What's Wrong With My Code?
    Replies: 38
    Last Post: April 13th, 2012, 05:35 AM
  5. [SOLVED] Java program to sort arrays containing dates
    By scottyadam in forum Collections and Generics
    Replies: 1
    Last Post: March 9th, 2009, 06:08 PM

Tags for this Thread