How can i convert the program into modular programming?
public class number{
public static void main(String args[])throws Exception{
int num,lb,ub,range,i=0,sum=0,hold,times1=0,j;
System.out.print("Lower Bound:");
lb=Keyboard.readInt();
System.out.print("Upper Bound:");
ub=Keyboard.readInt();
range=ub-lb;
System.out.print("How many number you want to display?");
num=Keyboard.readInt();
int[] count=new int[num];
System.out.print("The number between "+lb);
System.out.print(" and "+ub);
System.out.println(" are: ");
for(i=0;i<num;i++)
count=(int)(Math.random()*range+lb);
System.out.println(count[i]);
sum=count[i]+sum;
System.out.println("The total is "+sum);
for (int pass=1;pass<count.length;pass++)
for(i=0;i<count.length-1;i++) // a single pass
if(count[i] > count[i+1]) {
hold = count[i]; // swap elements
count[i] = count[i+1];
count[i+1] = hold;
System.out.println("Data after sorting:");
for(i=0;i<count.length;i++){
System.out.println(count[i]);
System.out.println("***Frequency of the number***");
for(i=0;i<=count.length-1;i++){
int times=1;
for(j=i+1;j<count.length;j++)
if(count[i]==count[j])
times=times+1;
System.out.print(count[i]);
System.out.print(" = ");
System.out.println(times+" times");
if(i!=1)
times1=times-1;
if(i>0){
times1=times+i-1;
i=times1;
System.out.println("");
int up,low;
System.out.println("***Key in the range***");
System.out.print("Lower Bound : ");
low=Keyboard.readInt();
System.out.print("Upper Bound : ");
up=Keyboard.readInt();
for(i=0;i<num;i++){
int times=1;
for(j=i+1;j<num;j++){
if(count[i]==count[j])
times=times+1;
if((count[i]>=low)&&(count[i]<=up))
System.out.println(count[i]);
if(i!=1){times1=times-1;}
if(i>0){times1=times+i-1;}
i=times1;
here are my program.
please help me to convert it into modular program by using below method and constructor.
1)valueIn():fill in the array by generating random number between given range.range is given by user.
2)valueOut(): to display all the value in the array.
3)total():calculate total of all the value in an array.
4)arrange():sort the number.
5)findOur():to display the frequency of the number.
6)rangeOut():user give a range aggain to display all the number between the given range.
Idon't think it is fair to have us do what looks to be your homework. The problem is fairly simple, why not take a stab at it and let us comment on it?
Chuck
Similar Messages
-
How can i convert 3d movie into 2d to watch it in mac
i have a movie with mkv file playable on vlc how can i convert the movie into 2d
There are now a bunch of them out there. Do a Google search for "mac 3D conversion" They tend to be around $35. I have been using iSkysoft products, which have been fairly easy to use. They have a "iMedia Converter Deluxe for Mac" that besides the 3D to 2D conversion, will also convert video to 70+ formats, has a 1-Click Video Downloader, and a single click Rip DVD and Burn to DVDs feature. Also claims to be "Ultrafast" all for the same price others apps are that only do the conversion.
-
As I opened the places.sqlite with an sqlite-editor I found out that firefox saves the last_visit_date via a timestamp which is 16 digits long. I realized that the first 10 digits are similar to the corresponding unix-timestamp but not equal. So.. how can i convert the firefox-timestamp into a normal date? Or into the corresponding unix-timestamp?
Write a bash script or 'C' program to change the date format and then use the sql update function to receive the stdio output 'where date_field='embeded date value'.
-
How can I convert the ringtone (m4r file) I made into an mp3 file on itunes?
How can I convert the ringtone (m4r file) that I made into an mp3 file on iTunes? I want to put it on a CD, but I can't figure out how to convert it. I didn't buy it, I made it by converting a YouTube video into an mp3 (I wanted to get the little song in the video for a ringtone.) I'm not sure what to do.
Hello ed2345,
Thanks for the help, but this is not the problem.
It's hard to describe the problem, but I'll try it again, this time with pictures.
I was left with the following folders in the iTunes Downloads folder.
http://www.picfront.org/d/7yb3
These TMP Folders have a download.m4a and a Info.plist file.
After moving the audio files in iTunes a bit I get this.
http://www.picfront.org/d/7yb2
As you can see no other Information for the download.m4a than the length.
That's how the .m4p file looks like
http://www.picfront.org/d/7yb1
And this is how the same .m4a file currently looks
http://www.picfront.org/d/7yb0
Like I said, I could edit all these download.m4a files by myself but that would leave some information out.
Note: Sorry, I hope the links do not spam you with annoying ads. I don't get any but I was told that there can be some annoying one. -
How can I convert the volume directory into a single file installer?
How can I convert the volume directory into a single file installer? I would like to hide all the miscillaneous files that I don't care for and be able to have the installer double click a single file and have it automatically install.
On the second prompt screen when prompted 'What kind of self-extracting Zip file file do you want to make?'
Are you choosing the second option (self-extracting Zip file for software installation)?
I have a word file that I created to help me remember - is there anyway to email it to you? -
How can i convert the HTML information in XML form to a PDF?
Hi does any body know how can i convert the content of an HTML field in a XML Form in a regular text to include in a PDF in a Java program?
Hi ,
On the tool bar you have an option "Browser" which is next to "HTML Editor" .
You know that for using these elements wo have to map them with Data Schema.
Step by step
1. In data Model Under Data Schema Add a child and name it Read_More.
2. In the left hand corner ,click on tab Type and from the drop down select "rid"
3.Click on the "Browser" from the toolbar (as told earlier) and drag and drop it on the form.
4. Drag the Data schema which u have made(Read_more) and drop it on the browser on form. On right hand side u will se the mapping done.
5.Click on the "Browser" which is there in the form and on the right hand side of the form u will see the property window.
6.In property window change the value of action property to "Item Entry point"
7. Repeat step 3 and 4 in Render and show form but using "label" nad not browser.
Do not forget to add Save button in Edit Form.
This will solve your problem.
PS:Rewards Point Please.
Regards,
Naveen Gupta -
How can I convert DVD- video into Apple's format so that I can play the content on my Mac and also stream it to my Apple TV? A few years ago, I transferred all of my home videos onto DVD but now would really like to put these onto my Mac and stream them through Apple TV to watch on the "big screen". Any advice would be most welcome!! Thanks
MPEG Streamclip.
Apple do not have their "own" format. You need to convert your DVDs to H.264 though. -
I have a 2 page (portaait format) PDF file how can I convert the PDF file into landscape format before I change it to XL?
Hi jsremick,
To change the page orientation of a PDF, you need to use Acrobat. (Reader allows you to rotate the page view, but not the pages themselves).
If you don't have Acrobat, feel free to give it a try. You can download the free 30-day trial from http://www.adobe.com/products/acrobat.html.
Best,
Sara -
How can i convert the data from mutiple-table to the other database(MSSQL)?
Dears,
How can i convert the data from mutiple-table to the other database such as MS-SQL?
I have a third party system based on MS-SQL 2000.
Now we want to make a integration between SAP R/3(Oracle) and SQL server.
When my user releases the purchase order in R/3, the application we coded will convert the releated data to the temp database on the SQL server.
But i don't know which tools will help me reach the purpose. BAPI, LSMW, IDoc... ???
Would anybody tell me which way is better and how to do?
Thanks a lot!
Kevin WangHello Kevin,
The question to use which method depend on your detail requirements. If you use BAPI, you need to find which Bapi can provide the data you want. Bapi normally use as a function called by external system. So you need to develop an external program like VB/Java to call this Bapi and move it to SQL. LSMW is use when you want to upload data from an external system to SAP. So it does not serve your requirement. Idoc can be use to export data to an external system. Again like Bapi, you need to find what Idoc can provide the data you want. However, it does not any programming from the external system. If I were you, based on your requirements, I think writing an Abap program that read the data you want and download it to NT/SQL server will be faster and easier. -
HT4059 How can I convert a pdf into an ibook?
How can I convert a pdf into an ibook? I've got a host of PDF's that I'd like to bring into the software but need a quick and simple tool to pull them through. Any ideas?
In the help of Acrobat look for Form.
-
How can i convert my pdf into excel
How can I convert my pdf into excel, the tutorial shows a "content converter" option under the tools section but I do not have that option. I have Acrobat Pro v11.
With Acrobat XI Pro use this click-path:
File - Save As Other - Spreadsheet -
Then select the option desired.
Be well... -
How can i convert the quantity of one unit to other unit in BI 7?
Hi ,
I have developed an RFC function module in SAP BW (BI 7.0).
For this function module I have to populate material number and Quantity required and UNIT.Every thing working good. If the user forgets to enter unit or enters other unit where Quantity in ODS is not mentioned in terms of that unit.WE have to Convert the Quantity requested into the Qunantity that exist in ODS or DATA BASE based on the unit of measure .
Please suggest me how can I convert the UNIT of measure of quantity?
Thanks,
Suresh.I have to do this with conversion table /BIO/PMAT_UNIT.
IN THIS TABLE I DON'T KNOW HOW CAN I CONVERT?
REGARDS,
SURESH. -
How can I convert a layer into a smart object with Adobe Photoshop Elements 10?
How can I convert a layer into a smart object with Adobe Photoshop Elements 10?
That feature is only in PS. Elements as you buy it has only limited support for smart objects. If you use File>Place to add something to your image it will come in as a smart object (within the limits to which PSE understands smart layers). However, if you know someone who can write an action for you in PS you can install it in PSE, or you could look into something like elements+ from simplephotoshop.com.
-
How can I convert page points into document points??
Hello,
How can I convert page points into document points? any API?
I have found 2 APIs
AIDocumentViewSuite::ArtworkPointToViewPoint( ) and
AIDocumentViewSuite::ViewPointToArtworkPoint( )
but I dont know what is view point and art work point.
I think artwork point = page points and view points = document points. am I correct ???What do you mean by 'document points'? Do you mean document units? Like centimeters or inches? If that, there's no API to do (well, kind of in AIUser.h, but that gives you back a string with a unit suffix). Frankly, its pretty easy to just figure out the conversion values for each type of ruler unit -- there are only five or so you need -- and then write a dinky function that takes a value in one or the other, looks up the current document unit and uses that to convert the value (one function for each way). You just need to figure out everything in terms of points (since pixels == points) -- in that regard, it probably helps to know that 72 pt == 1 inch. From that you can figure out pointer-per-inch|centimeter|millimeter|pica.
-
how can i convert my song into .mr4 for making it my ringtone, just renaming it is not working?
Here's how:
If you are using Windows, make sure you are able to view the file extension.
http://support.microsoft.com/kb/865219
1. Select a title (.mp3 or .m4a) in your iTunes Music Library
2. Do File > Get Info on selected title (Windows do Edit > Get Info)
3. In the dialog choose Options tab
4. Set Start Time and End Time (no more than 35 secs otherwise won't work)
5. Close dialog.
6. Now control click the title (right click) and choose Create AAC Version
Note: If you don't have Create AAC version, switch in menu File > Preferences...(Windows do Edit > Preferences...) > General > Import Settings... > Import Using: AAC Encoder.
7. When it is done, drag the newly create title to the desktop.
8. Delete the newly create title in iTunes. <-- This step is important
9. Rename the title on your desktop from ringtone.m4a to ringtone.m4r
10. Drag and drop it into iTunes
Now you have a ringtone.
Make sure it is selected in iTunes > Tones for syncing with your new iPhone. -
I have written an ebook that has been created for kindle. How can I export the book into iBooks Author?
I have tried converting the book to different files like, mobi, epub, pdf. By using an app on my iphone.
I still cannot add it to iBooks Author.
I'm stuck, Please help me!Either use copy/paste and then format/style as desired, or take it to Pages or WORD and insert chapters - which may still require resettling.
If you're looking for a 1:1 port, with all styles and layout intact, you may be dissapointed, tho.
Maybe you are looking for
-
Exception Handling at class level
This is a quick one. I've never used a try catch event handling statement at the class level where I declare all my variables before. Is is ok to do this? Can someone perhaps show me some psuedo code like this? private final ImageIcon[] CAT_BULLETS =
-
Hello, I'm try to runing an aplication on weblogic and now I stuck on this issue. Could anyone help me to solve this? Exception activating module: EJBModule(ejb.jar) Unable to deploy EJB: DrawingPhaseSessionEJB from ejb.jar: [EJB:011008]Unable to bin
-
How can I refresh Dynamic Variables in OBIEE in a Unix enviroment? and can I only refresh a certain list of them?
-
SSI includes do not display in design view.
Hi, I am working on an existing site. By "existing", I mean there was no Dreamweaver site definition. I created the site definition but, when I open pages that use ssi, the included files do not show in design view. If I reinsert the include, it show
-
Trying to Install Tiger iMovie HD on Snow Leopard But Can't
I really like iMovie HD better than iMovie 09. I used to have a 2006 MBP with Tiger and iMovie HD, but the laptop went sour and Apple replaced it with a mid-2009 MBP with Leopard. I really don't like this iMovie and it seems to render video different