How to code this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

How to code this

Write a times table program. The program should ask a user to input a number in a dialogbox. This number is then used as the times table. So, if the user enters 10, the 10 times table should be displayed. Your Output window should look something like this, when your program is run.

4th Oct 2022, 1:29 PM
great Nile
5 Answers
+ 3
What language? Also show your attempt. We don't simply provide answers for homework here. This is a learning platform.
4th Oct 2022, 2:01 PM
Chris Coder
Chris Coder - avatar
+ 3
You just copied this from your homework sheet, right? there is not "something like this" to look at. If you want to solve it, learn the basics of a programming language (You did not tag any). Then try to print the table. Then look for a ui framework that allows you to create a window.
4th Oct 2022, 2:01 PM
Lisa
Lisa - avatar
+ 1
package userinput; import javax.swing.JOptionPane; public class Program { public static void main(String[] args) { String num1 = JOptionPane.showInputDialog("Number you wish to multiply"); int number = Integer.parseInt(num1); int counter; int product; String result = ""; for (counter=1;counter<11;counter++) { product = number * counter; result = counter + " times " +number+ " = "+product; JOptionPane.showMessageDialog(null, result,"Product",JOptionPane.INFORMATION_MESSAGE); } } }
6th Oct 2022, 2:51 PM
Solo
Solo - avatar
0
package userinput; import javax.swing.JOptionPane; public class Program { public static void main(String[] args) { JOptionPane.showInputDialog("Number you wish to multiply"); int number = Integer.parseInt(num1); int counter; int product; String result = ""; for (counter=1;counter<11;counter++) { product = number * counter; result = counter + " times " +number+ " = "+product; JOptionPane.showMessageDialog(null, result,"Product",JOptionPane.INFORMATION_MESSAGE); } } }
6th Oct 2022, 11:37 AM
great Nile
0
That is my attempt
6th Oct 2022, 11:37 AM
great Nile