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 15 in Java by MIH
• 160 points
64 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,890 points
82 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
185 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,090 points
10,329 views
0 votes
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,060 points
98 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 in Java by Gitika
• 29,690 points
209 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
• 53,110 points
390 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,190 points
348 views
+1 vote
11 answers

How to send HTTP POST requests on Java?

How to invoke Thread dump analysis API? Invoking ...READ MORE

answered Jun 16, 2019 in Java by Jim
• 810 points

reshown Jun 17, 2019 by Vardhan 50,518 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,890 points
1,505 views
0 votes
10 answers

Java - sending HTTP parameters via POST method easily

I personally use Apache's HTTPClient/HttpCore libraries to do ...READ MORE

answered Dec 10, 2018 in Java by robocop
36,066 views