Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to arrange the result neatly? public class LabTest { public static void main(String[] args) { String[] state= {Johor, Kedah,Kelantan,Melaka,Negeri Sembilan,Pahang,Perak,Perlis,Pulau Pinang,Sabah,Sarawak,Selangor,Terengganu,Wilayah Persekutuan Labuan,Wilayah Persekutuan

How to arrange the result neatly?

public class LabTest { public static void main(String[] args) { String[] state= {"Johor", "Kedah","Kelantan","Melaka","Negeri Sembilan","Pahang","Perak","Perlis","Pulau Pinang","Sabah","Sarawak","Selangor","Terengganu","Wilayah Persekutuan Labuan","Wilayah Persekutuan Kuala Lumpur"}; int [] rainfall= {1133,1312,1699,1220,1450,1596,1350,1189,1347,1987,1999,1125,1789,1980,1374}; int temp; String tempN; for (int i=0;irainfall[j]){ temp=rainfall[i]; rainfall[i]=rainfall[j]; rainfall[j]=temp; tempN=state[i]; state[i]=state[j]; state[j]=tempN; } } }

for (int i=0;i

image text in transcribed

Sabah Kelantan Pahang Perak Pulau Pinang Kedah Sarawak Wilayah Persekutuan Labuan Terengganu Negeri Sembilan Wilayah Persekutuan Kuala Lumpur Melaka Perlis Johor Selangor 1374 BUILD SUCCESSFUL (total time: 0 seconds) 1999 1987 1980 1789 1699 1596 1450 1350 1347 1312 1220 1189 1133 1125

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions