SlideShare a Scribd company logo
(15 points) TASK 2: Update Task 1: (You may use your IDE or Text File to execute program.)
Place the above code into a do-while / switch case menu.
Allow the user to choose which operation she will perform.
**************************************
* Main Menu: *
* Enter # to run program or Quit *
* 1) Is Input divisible by 5 and 6 *
* 2) Is Input divisible by 5 or 6 *
* 3) Is 10 divisible by 5 or 6, but not both *
* 4) Quit *
**************************************
1)
Enter an integer:
10 // Users enters 10
Is 10 divisible by 5 and 6? No
(Attach snipping photo of source code and output.)
Solution
import java.util.*;
public class Divisibility
{
boolean div1(int n)
{
return ((n%5==0) && (n%6==0));
}
boolean div2(int n)
{
return ((n%5==0) || (n%6==0));
}
boolean div3()
{
return ((10%5==0) && (10%6==0));
}
public static void main(String args[])
{
int x = 0, y = 0;
do
{
System.out.println("*MAIN MENU");
System.out.println("1) Run Program");
System.out.println("2) Is input divisible by 5 or 6");
System.out.println("3) Is input divisible by 5 and 6");
System.out.println("4) Is 10 divisible by 5 or 6");
System.out.println("5) Quit");
Scanner s = new Scanner(System.in);
System.out.println("Enter A Choice");
y = s.nextInt();
Divisibility d = new Divisibility();
switch(y)
{
case 1: main(null);
break;
case 2: System.out.println("Enter an integer");
x = s.nextInt();
System.out.println(d.div1(x));
break;
case 3: System.out.println("Enter an integer");
x = s.nextInt();
System.out.println(d.div2(x));
break;
case 4: System.out.println(d.div3());
break;
case 5: System.exit(0);
break;
}
}
while(y!=5);
}
}

More Related Content

DOCX
Lab #5_Revised  (Due 121315)This is a revision on the previous.docx
PDF
InnerSoft CAD Manual
PDF
CC 3 - Module 2.pdf
PDF
ICT1002-W8-LEC-Introduction-to-C.pdf
PPT
C# Tutorial MSM_Murach chapter-15-slides
PDF
Ecet 340 Teaching Effectively--tutorialrank.com
DOC
Cis 115 Education Redefined-snaptutorial.com
PPTX
Hack2the future Microsoft .NET Gadgeteer
Lab #5_Revised  (Due 121315)This is a revision on the previous.docx
InnerSoft CAD Manual
CC 3 - Module 2.pdf
ICT1002-W8-LEC-Introduction-to-C.pdf
C# Tutorial MSM_Murach chapter-15-slides
Ecet 340 Teaching Effectively--tutorialrank.com
Cis 115 Education Redefined-snaptutorial.com
Hack2the future Microsoft .NET Gadgeteer

Similar to (15 points) TASK 2 Update Task 1 (You may use your IDE or Text Fil.pdf (20)

PDF
Introduction to Box2D Physics Engine
PDF
step by step to write a gnome-shell extension
PDF
Gui builder
PDF
report
PPTX
Ch10 Program Organization
PDF
Java Programming Assignment
PDF
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
DOCX
Project 2Project 2.pdfIntroduction to Programming EECS 1.docx
PDF
lecture_slides_esteem2019-231.pdf
PDF
DeVry GSP 115 All Assignments latest
DOCX
Main Java[All of the Base Concepts}.docx
PPTX
Jm guide
PPTX
Keynote + Next Gen UIs.pptx
PDF
Survey_Paper
DOCX
Algoritmos sujei
DOCX
Lab mke1503 mee10203 02
DOCX
Problemas secuenciales.
DOCX
Problemas secuenciales.
DOCX
Problemas secuenciales.
Introduction to Box2D Physics Engine
step by step to write a gnome-shell extension
Gui builder
report
Ch10 Program Organization
Java Programming Assignment
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
Project 2Project 2.pdfIntroduction to Programming EECS 1.docx
lecture_slides_esteem2019-231.pdf
DeVry GSP 115 All Assignments latest
Main Java[All of the Base Concepts}.docx
Jm guide
Keynote + Next Gen UIs.pptx
Survey_Paper
Algoritmos sujei
Lab mke1503 mee10203 02
Problemas secuenciales.
Problemas secuenciales.
Problemas secuenciales.
Ad

More from archiespink (20)

PDF
How does the oxygen status of lake sediments affect phosphorus avail.pdf
PDF
How do risk assessment and risk management inform the environmenta.pdf
PDF
Having a lot of difficulty with this discrete math question. Cant .pdf
PDF
Given the following information about a continuous-time LTI system (.pdf
PDF
For Cooperative Diversity (CD) system, please talk about its potenti.pdf
PDF
Explain how the concept of race has developed in the Western world. .pdf
PDF
Economics of Money, Banking and Financial Markets, Business School 3.pdf
PDF
During her quarantine, Mary Mallon secretly had her feces tested by .pdf
PDF
describe generally how animals seem to balance personal and public i.pdf
PDF
Complete the table for each of these major NTs. SolutionNeurot.pdf
PDF
Arrange the following enzymes in the order of their action during DNA.pdf
PDF
[10] Write a Java application which first reads data from the phoneb.pdf
PDF
Which of the following enzymes does not catalyze the formation of a .pdf
PDF
Which group is shown as an ion hat are bonded to one of the carbon .pdf
PDF
Where is the specific location in an animal where cells are undergoin.pdf
PDF
Which of the following is the oldest synapomorphy found in all anima.pdf
PDF
uicfise 8f Tea Par . A coherent and strong national leadership is an .pdf
PDF
To discourage cheating, a professor makes throe different versions of.pdf
PDF
The number of messages arriving at a multiplexer is a Poisson random .pdf
PDF
The most liquid of the money market securities are a. T-Bills. b. co.pdf
How does the oxygen status of lake sediments affect phosphorus avail.pdf
How do risk assessment and risk management inform the environmenta.pdf
Having a lot of difficulty with this discrete math question. Cant .pdf
Given the following information about a continuous-time LTI system (.pdf
For Cooperative Diversity (CD) system, please talk about its potenti.pdf
Explain how the concept of race has developed in the Western world. .pdf
Economics of Money, Banking and Financial Markets, Business School 3.pdf
During her quarantine, Mary Mallon secretly had her feces tested by .pdf
describe generally how animals seem to balance personal and public i.pdf
Complete the table for each of these major NTs. SolutionNeurot.pdf
Arrange the following enzymes in the order of their action during DNA.pdf
[10] Write a Java application which first reads data from the phoneb.pdf
Which of the following enzymes does not catalyze the formation of a .pdf
Which group is shown as an ion hat are bonded to one of the carbon .pdf
Where is the specific location in an animal where cells are undergoin.pdf
Which of the following is the oldest synapomorphy found in all anima.pdf
uicfise 8f Tea Par . A coherent and strong national leadership is an .pdf
To discourage cheating, a professor makes throe different versions of.pdf
The number of messages arriving at a multiplexer is a Poisson random .pdf
The most liquid of the money market securities are a. T-Bills. b. co.pdf
Ad

Recently uploaded (20)

PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PDF
RMMM.pdf make it easy to upload and study
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
Weekly quiz Compilation Jan -July 25.pdf
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
master seminar digital applications in india
PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
RMMM.pdf make it easy to upload and study
History, Philosophy and sociology of education (1).pptx
A systematic review of self-coping strategies used by university students to ...
Module 4: Burden of Disease Tutorial Slides S2 2025
STATICS OF THE RIGID BODIES Hibbelers.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Supply Chain Operations Speaking Notes -ICLT Program
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Paper A Mock Exam 9_ Attempt review.pdf.
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
LDMMIA Reiki Yoga Finals Review Spring Summer
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Weekly quiz Compilation Jan -July 25.pdf
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
master seminar digital applications in india
UNIT III MENTAL HEALTH NURSING ASSESSMENT

(15 points) TASK 2 Update Task 1 (You may use your IDE or Text Fil.pdf

  • 1. (15 points) TASK 2: Update Task 1: (You may use your IDE or Text File to execute program.) Place the above code into a do-while / switch case menu. Allow the user to choose which operation she will perform. ************************************** * Main Menu: * * Enter # to run program or Quit * * 1) Is Input divisible by 5 and 6 * * 2) Is Input divisible by 5 or 6 * * 3) Is 10 divisible by 5 or 6, but not both * * 4) Quit * ************************************** 1) Enter an integer: 10 // Users enters 10 Is 10 divisible by 5 and 6? No (Attach snipping photo of source code and output.) Solution import java.util.*; public class Divisibility { boolean div1(int n) { return ((n%5==0) && (n%6==0)); } boolean div2(int n) { return ((n%5==0) || (n%6==0)); } boolean div3() { return ((10%5==0) && (10%6==0));
  • 2. } public static void main(String args[]) { int x = 0, y = 0; do { System.out.println("*MAIN MENU"); System.out.println("1) Run Program"); System.out.println("2) Is input divisible by 5 or 6"); System.out.println("3) Is input divisible by 5 and 6"); System.out.println("4) Is 10 divisible by 5 or 6"); System.out.println("5) Quit"); Scanner s = new Scanner(System.in); System.out.println("Enter A Choice"); y = s.nextInt(); Divisibility d = new Divisibility(); switch(y) { case 1: main(null); break; case 2: System.out.println("Enter an integer"); x = s.nextInt(); System.out.println(d.div1(x)); break; case 3: System.out.println("Enter an integer"); x = s.nextInt(); System.out.println(d.div2(x)); break; case 4: System.out.println(d.div3()); break;