java basics

java basics

1.Write a program that will grade the students quiz. The program will ask the user to enter the number of the questions in the quiz, the right answer for each question and save it in array. The program will ask the user to enter the student answers to be checked and show the number of right answers and the final grade as a percentage. The program will ask if the user want to grade another quiz.

2Write a program that uses an array of 10 stings. Write methods that carry out each of the following operations: 1 Input from the keyboard via a text field values for all of the components of the array. 2 Display the values. (You can now observe that they have been entered correctly into your array.) 3 Input a word from the keyboard and search to see whether it is present in the array. Display a message to say whether it is present in the array or not.

View Answers

April 24, 2012 at 5:00 PM

import javax.swing.*;

    public class StringArrayExample{
        public static void main(String[]args){
            String array[]=new String[10];
            for(int i=0;i<array.length;i++){
                String st=JOptionPane.showInputDialog(null,"Enter string:"+(i+1));
                array[i]=st;

            }
            System.out.println("Array Elements: ");
             for(int i=0;i<array.length;i++){
                 System.out.println(array[i]);
             }
            String str=JOptionPane.showInputDialog(null,"Enter word:");
            int count=0;
            for(int i=0;i<array.length;i++){
                if(array[i].equals(str)){
                    count++;
                }
            }
            if(count>=1){
                System.out.println("Word is present in the array!");
            }
            else{
                System.out.println("Not present!");
            }
        }
      }

Ads









Related Tutorials/Questions & Answers:
Java basics
Java basics  What do you mean by Legacy class
java basics
java basics  how to show all the decimal places in a double value
Advertisements
java basics
java basics  Write a java program to calculate the sum of the series as given below: 1 - 2 + 3 - 4 + 5 - 6 + 7 - 8 + 9
java basics
java basics  Sir i want to searching through name and id in java. and i want to show all the record(like father`s name, date of joining, maid add and mobile no. etc) of particular employee by choosing id and name   
java basics
java basics  1.Write a program that will grade the students quiz. The program will ask the user to enter the number of the questions in the quiz, the right answer for each question and save it in array. The program will ask
What are the basics of Java
What are the basics of Java  Hi, I want to know the basics of Java... of Java? Thanks   What are the basics of Java? Java is a programming.../. Read on to find out about the basics and learn about Java and its components
Java basics
Java Basics are necessary to learn by programmers who are willing to learn Java language. These basics must be followed every-time a program is made in Java. Java language is completely specified that helps the programmer
Java Basics Exercises Tutorial
Java Basics exercises tutorials teach you about the basic of the Java language that includes its definition, feature, code, keywords, etc. Definition: Java... the world to develop applications and softwares for mobile, desktop and tablet. Java
Java basics for beginners
With this article we are introducing beginners in Java with its basics. Java.... are extensively using Java technology. Java has Just In Time compilation and supports... modification called Write Once Run Anywhere (WORA) Java programs are simple, secure
the basics of ai
the basics of ai  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: the basics of ai Try... "the basics of ai". Also tell me which is the good training courses
ModuleNotFoundError: No module named 'basics'
ModuleNotFoundError: No module named 'basics'  Hi, My Python... 'basics' How to remove the ModuleNotFoundError: No module named 'basics'... to install padas library. You can install basics python with following command
HIBERNATE- BASICS
and as it is the main Database company in j2ee world, EJB-3 has bright future. J2EE( Java... container. The pattern of defining a typical Javabean is a recurring theme in Java
machine learning basics for beginners
machine learning basics for beginners  Hi, I am beginner in Data...: machine learning basics for beginners Try to provide me good examples or tutorials links so that I can learn the topic "machine learning basics
the basics of machine learning
the basics of machine learning  Hi, I am beginner in Data Science...: the basics of machine learning Try to provide me good examples or tutorials links so that I can learn the topic "the basics of machine learning". Also tell
basics to learn machine learning
basics to learn machine learning  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: basics... so that I can learn the topic "basics to learn machine learning"
basics of machine learning for beginners
basics of machine learning for beginners  Hi, I am beginner in Data...: basics of machine learning for beginners Try to provide me good examples or tutorials links so that I can learn the topic "basics of machine learning
ModuleNotFoundError: No module named 'django-basics'
ModuleNotFoundError: No module named 'django-basics'  Hi, My... 'django-basics' How to remove the ModuleNotFoundError: No module named 'django-basics' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'django-site-basics'
ModuleNotFoundError: No module named 'django-site-basics'  Hi, My... named 'django-site-basics' How to remove the ModuleNotFoundError: No module named 'django-site-basics' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django-tgb-basics'
ModuleNotFoundError: No module named 'django-tgb-basics'  Hi, My... named 'django-tgb-basics' How to remove the ModuleNotFoundError: No module named 'django-tgb-basics' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django-tgb-basics'
ModuleNotFoundError: No module named 'django-tgb-basics'  Hi, My... named 'django-tgb-basics' How to remove the ModuleNotFoundError: No module named 'django-tgb-basics' error? Thanks   Hi, In your
Java and HTML: The Basics
Java and HTML: The Basics       Before going any further lets start with the basics of HTML first. In this section we will come to know about all the tags which are required
Enterprise JavaBeans (EJB) Basics
on Java platform. In EJB Basics, you need to learn all the basic components...The EJB Basics is an essential component of the programming language for those who want to development software on Java platform, as without the proper
Basics of Social Media Marketing for Beginner
Social Media Marketing Basics for the Beginner and Advanced Basics of Social... with these strategies or they have years of experience, they need to know the basics... scheme so much that these basics are forgotten. SMM(Social Media Marketing
Going Back to Basics of Social Media Marketing
Social Media Marketing: Going Back to Basics Social Media Marketing should... in their promotional strategy plan, they need to go back to the basics to learn the first... parts of this type of marketing but if a person skips the basics then the most
java basic
java basic  Java Basics tutorials
Java Tutorial
Learn Java with the Java Tutorial and articles. Welcome to the Java Tutorial section of our famous Java Tutorial website. This Java Tutorial programming section is for the beginners. This section teaches you the basics of Java
Introduction to the Java Persistence API
to introduce you about the Java Persistence API. The Java Persistence API is Java standard for persisting the Java Objects (Entity) to the relational database. It provides a way to bridge the gap between Java model and relational
Writing Simple Java Script Program
Writing Simple Java Script Program       In this article you learn the basics... JavaScript Program In the last lesson you learned how to create simple java script
Conditions In Java Script
Conditions In Java Script       In this article you learn the basics of JavaScript and create your first JavaScript program. About JavaScript Java
Basics of global positioning system
Basics of global positioning system The Global Positioning system is slowly and steadily making a niche for itself. More and more number of people are beginning to be aware of this technology. This has contributed to increase
Java Script With Links and Images
Java Script With Links and Images       In this article you learn the basics of JavaScript and create your first JavaScript program. JavaScript Images

Ads