HOw can i do this

0 votes
  1. The department of History has just bought a new photocopier. Any person using the photocopier must enter an identification code.  You have been asked to do the following: 
  • Write a program that determines whether identification codes typed by users of a photocopier are valid, and prints appropriate messages. If the identification code, which is a four-digit number, is correct your program computes the cost of copying according to the table below.
  • Your program should prompt the user for an identification code, read it and determine whether it is valid. An identification code is valid if its rightmost digit is correct.  A correct digit is equal to the remainder of the sum of the other three digits divided by 7. For example, a valid code that gives a correct digit is   7011.  However, 9999 is not a valid code. 7011 is a valid code because (7+0+1)%7 = 1, which is equal to the rightmost digit of 7011.  But 9999 is not a valid code because (9+9+9)%7 = 6, which is not equal to the rightmost digit of  9999.

Correct digits are assigned as follows:

Student: 1, 2   (means 1 or 2)

Teacher: 3, 4, 5

Secretary: 6

Others: 7, 8, 9

Number of pages

1 to 10

10 to 20

>20

Students

0.10 Dhs

20% off

40% off

Teachers

0.30 Dhs

30% off

40% off

Secretaries

0.20 Dhs

25% off

40% off

Others

0.60 Dhs

10% off

20% off

Apr 16, 2020 in Java by MIH
• 150 points
426 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Java

0 votes
2 answers

How can I do url string decoding in java

We can use URLDecoder: URLDecoder.decode( url, "UTF-8" ); READ MORE

answered Dec 7, 2018 in Java by Sushmita
• 6,910 points
577 views
0 votes
2 answers

Unfortunately MyApp has stopped. How do I solve this?

The common solution for solving App has ...READ MORE

answered Mar 6, 2019 in Java by AllisonE
• 180 points
757 views
0 votes
1 answer

How can I solve this: To prevent a memory leak, the JDBC Driver has been forcibly unregistered

What can you do? Ignore these warnings. Tomcat ...READ MORE

answered Jan 8, 2019 in Java by Daisy
• 8,120 points
30,357 views
+1 vote
1 answer

How can I solve this example in an easy way??

You can use this code: import java.util.*; public class ...READ MORE

answered Sep 23, 2019 in Java by Omkar
• 69,210 points
606 views
0 votes
1 answer

What is Modeshape. How can i use this?

ModeShape is an open-source implementation of the JSR-283 specification and ...READ MORE

answered Mar 30, 2020 in Java by Gitika
• 65,910 points
820 views
0 votes
2 answers

How can I convert a String variable to a primitive int in Java

 Here are two ways illustrating this: Integer x ...READ MORE

answered Aug 20, 2019 in Java by Sirajul
• 59,230 points
1,918 views
0 votes
2 answers

Send HTTP request in Java

import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.javanet.NetHttpTransport; import java.io.IOException; import ...READ MORE

answered Aug 3, 2018 in Java by samarth295
• 2,220 points
1,498 views
+1 vote
13 answers

How to send HTTP POST requests on Java?

With Apache HttpClient In the old days, this Apache ...READ MORE

answered Dec 10, 2020 in Java by Rajiv
• 8,910 points
157,388 views
0 votes
2 answers

Performing HTTP POST operation in JAVA

I'm using JSON-Java to build my JSON object: JSONObject json ...READ MORE

answered Nov 26, 2018 in Java by Sushmita
• 6,910 points
4,246 views
0 votes
12 answers

Java - sending HTTP parameters via POST method easily

Below are the steps we need to ...READ MORE

answered Dec 11, 2020 in Java by Rajiv
• 8,910 points
109,270 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP