Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I want a date like ddmmyyy . how can i do in this package bomb; import java.util.Random; public class Bomb { public static void main(String[]

I want a date like ddmmyyy. how can i do in this

package bomb;

import java.util.Random;

public class Bomb {

public static void main(String[] args) { //date int date=11022016; //counter int count=0; //random number generator Random ran=new Random(); int rannumb; do { count=count+1; //8 digit random number rannumb=10000000+ran.nextInt(90000000); //printing 5 times if(rannumb==date) { for(int k=0;k<5;k++) { System.out.println("Today is "+date); System.out.println("The count is "+count); System.out.println(); } break; } }while(true); } }

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