SlideShare une entreprise Scribd logo
1  sur  3
INFORMATION AND COMMUNICATIONS UNIVERSITY
SCHOOL OF EDUCATION
An Assignment Submitted In Partial Fulfilment Of The Requirements For The Bed Degree In
Information And Communication Technology.
Assignment No. 1
Student Name: Mudimba Alex Moonde
SIN: 1505273873
Lecturer’s Name: Martin Phiri
Course: Java Programming
Email: Mudimbamoonde@gmail.com
Year: one(Second Semester)2016
Question1:
Write a program that will askthe userto enterthe amountof a purchase.The program shouldthen
compute the state and countysalestax.Assume the state salestax is4 percentandthe countysalestax
is2 percent.The program shoulddisplaythe amountof the purchase,the state salestax,the county
salestax,the total salestax,and the total of the sale (whichisthe sumof the amountof purchase plus
the total salestax). Hint:Use the value 0.02 to represent2percent,and0.04 to represent4percent.
Solution:
import javax.swing.JOptionPane;
public class SalesTax
{
public static void main(String []args)
{
//Datatypes Declaration.
final double Amount_of_Purchase;
double total_sales_tax ;
double total_sales ;
double state_sales_tax, county_sales_tax;
int radomNumber;
String user;
String client;
//end of datatypes declaration.
//------------------------------------------------------------
// the client performing the trasaction shoud enter name.
client=JOptionPane.showInputDialog("Enter Client name:");
user=JOptionPane.showInputDialog("Enter Amount Of Purchase.");
Amount_of_Purchase=Double.parseDouble(user);
// the random number is being genarated here..
radomNumber=(int)(Math.random()*8)+8;
Solution:
//state sales tax is calculated.
state_sales_tax=Amount_of_Purchase*0.04;
client.length();
//state county sales tax is calculated.
county_sales_tax=Amount_of_Purchase*0.02;
// total sales tax.
total_sales_tax = state_sales_tax + county_sales_tax;
// total sales.
total_sales = Amount_of_Purchase - total_sales_tax;
// this java option pane displays the results of the program.
JOptionPane.showMessageDialog(null, "n The Transaction Code is:" +client.length()+"/"
+radomNumber+"/"+"2016 -"+radomNumber);
JOptionPane.showMessageDialog(null,"n CLIENT NAME: "+ client+ "n------------------------
------------------"
+"n The Amount of Purchase is: Zmk " + Amount_of_Purchase+
"n------------------------------------------"+"n The Total Sales: Zmk " +
total_sales+"n------------------------------------------"
+"n The State_Sales_Tax: Zmk "+ state_sales_tax+ "n County_Sales_Tax: Zmk
" +county_sales_tax);
System.exit.(0);
} //end of program.
}

Contenu connexe

Similaire à Java programming assign 1

CRICOS Provider No. 00103D ITECH1400 Foundations of Progra.docx
CRICOS Provider No. 00103D ITECH1400 Foundations of Progra.docxCRICOS Provider No. 00103D ITECH1400 Foundations of Progra.docx
CRICOS Provider No. 00103D ITECH1400 Foundations of Progra.docxfaithxdunce63732
 
Business plan,we net it,AKKI
Business plan,we net it,AKKIBusiness plan,we net it,AKKI
Business plan,we net it,AKKIAKASH PATEL
 
Comp 122 lab 3 lab report and source code
Comp 122 lab 3 lab report and source codeComp 122 lab 3 lab report and source code
Comp 122 lab 3 lab report and source codepradesigali1
 
Prg 420 entire course
Prg 420 entire coursePrg 420 entire course
Prg 420 entire coursePRG420
 
Marketing plan for Profeso- By Shubh
Marketing plan for Profeso- By ShubhMarketing plan for Profeso- By Shubh
Marketing plan for Profeso- By ShubhShubh Patodi
 
Module programming
Module programmingModule programming
Module programmingKak Yong
 
MGT 3302 Case study Last updated July 26, 2019 Page 1
MGT 3302   Case study Last updated July 26, 2019  Page 1 MGT 3302   Case study Last updated July 26, 2019  Page 1
MGT 3302 Case study Last updated July 26, 2019 Page 1 DioneWang844
 
National Apps Hackathon - Mentoring Session
National Apps Hackathon - Mentoring SessionNational Apps Hackathon - Mentoring Session
National Apps Hackathon - Mentoring SessionMohammad Zaman
 
Assignment DetailsYou have learned that some markets are compet.docx
Assignment DetailsYou have learned that some markets are compet.docxAssignment DetailsYou have learned that some markets are compet.docx
Assignment DetailsYou have learned that some markets are compet.docxfaithxdunce63732
 
Admshs emp tech_q1_m1_l2_software application and platforms
Admshs emp tech_q1_m1_l2_software application and platformsAdmshs emp tech_q1_m1_l2_software application and platforms
Admshs emp tech_q1_m1_l2_software application and platformsDexter Dizon
 
Rising Redogen: Bold & Feasible Solutions for Business
Rising Redogen: Bold & Feasible Solutions for BusinessRising Redogen: Bold & Feasible Solutions for Business
Rising Redogen: Bold & Feasible Solutions for BusinessTanzeemReza
 
Campus Recruitment program for Engineering students ...
Campus Recruitment program for Engineering students                          ...Campus Recruitment program for Engineering students                          ...
Campus Recruitment program for Engineering students ...Pompeii Connect
 
GECBSP Guide GDSC India ML Study Jam organizer guide modified.pdf
GECBSP Guide GDSC India ML Study Jam organizer guide modified.pdfGECBSP Guide GDSC India ML Study Jam organizer guide modified.pdf
GECBSP Guide GDSC India ML Study Jam organizer guide modified.pdfDomendra Sahu
 

Similaire à Java programming assign 1 (20)

CRICOS Provider No. 00103D ITECH1400 Foundations of Progra.docx
CRICOS Provider No. 00103D ITECH1400 Foundations of Progra.docxCRICOS Provider No. 00103D ITECH1400 Foundations of Progra.docx
CRICOS Provider No. 00103D ITECH1400 Foundations of Progra.docx
 
Business plan,we net it,AKKI
Business plan,we net it,AKKIBusiness plan,we net it,AKKI
Business plan,we net it,AKKI
 
Marketing plan
Marketing planMarketing plan
Marketing plan
 
Comp 122 lab 3 lab report and source code
Comp 122 lab 3 lab report and source codeComp 122 lab 3 lab report and source code
Comp 122 lab 3 lab report and source code
 
Prg 420 entire course
Prg 420 entire coursePrg 420 entire course
Prg 420 entire course
 
Marketing plan for Profeso- By Shubh
Marketing plan for Profeso- By ShubhMarketing plan for Profeso- By Shubh
Marketing plan for Profeso- By Shubh
 
Module programming
Module programmingModule programming
Module programming
 
La5 programming
La5   programmingLa5   programming
La5 programming
 
MGT 3302 Case study Last updated July 26, 2019 Page 1
MGT 3302   Case study Last updated July 26, 2019  Page 1 MGT 3302   Case study Last updated July 26, 2019  Page 1
MGT 3302 Case study Last updated July 26, 2019 Page 1
 
National Apps Hackathon - Mentoring Session
National Apps Hackathon - Mentoring SessionNational Apps Hackathon - Mentoring Session
National Apps Hackathon - Mentoring Session
 
Unit 3
Unit 3Unit 3
Unit 3
 
Unit 3
Unit 3Unit 3
Unit 3
 
Unit 3
Unit 3Unit 3
Unit 3
 
Unit 3
Unit 3Unit 3
Unit 3
 
Lesson plan
Lesson planLesson plan
Lesson plan
 
Assignment DetailsYou have learned that some markets are compet.docx
Assignment DetailsYou have learned that some markets are compet.docxAssignment DetailsYou have learned that some markets are compet.docx
Assignment DetailsYou have learned that some markets are compet.docx
 
Admshs emp tech_q1_m1_l2_software application and platforms
Admshs emp tech_q1_m1_l2_software application and platformsAdmshs emp tech_q1_m1_l2_software application and platforms
Admshs emp tech_q1_m1_l2_software application and platforms
 
Rising Redogen: Bold & Feasible Solutions for Business
Rising Redogen: Bold & Feasible Solutions for BusinessRising Redogen: Bold & Feasible Solutions for Business
Rising Redogen: Bold & Feasible Solutions for Business
 
Campus Recruitment program for Engineering students ...
Campus Recruitment program for Engineering students                          ...Campus Recruitment program for Engineering students                          ...
Campus Recruitment program for Engineering students ...
 
GECBSP Guide GDSC India ML Study Jam organizer guide modified.pdf
GECBSP Guide GDSC India ML Study Jam organizer guide modified.pdfGECBSP Guide GDSC India ML Study Jam organizer guide modified.pdf
GECBSP Guide GDSC India ML Study Jam organizer guide modified.pdf
 

Dernier

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 

Dernier (20)

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 

Java programming assign 1

  • 1. INFORMATION AND COMMUNICATIONS UNIVERSITY SCHOOL OF EDUCATION An Assignment Submitted In Partial Fulfilment Of The Requirements For The Bed Degree In Information And Communication Technology. Assignment No. 1 Student Name: Mudimba Alex Moonde SIN: 1505273873 Lecturer’s Name: Martin Phiri Course: Java Programming Email: Mudimbamoonde@gmail.com Year: one(Second Semester)2016 Question1: Write a program that will askthe userto enterthe amountof a purchase.The program shouldthen compute the state and countysalestax.Assume the state salestax is4 percentandthe countysalestax is2 percent.The program shoulddisplaythe amountof the purchase,the state salestax,the county salestax,the total salestax,and the total of the sale (whichisthe sumof the amountof purchase plus the total salestax). Hint:Use the value 0.02 to represent2percent,and0.04 to represent4percent.
  • 2. Solution: import javax.swing.JOptionPane; public class SalesTax { public static void main(String []args) { //Datatypes Declaration. final double Amount_of_Purchase; double total_sales_tax ; double total_sales ; double state_sales_tax, county_sales_tax; int radomNumber; String user; String client; //end of datatypes declaration. //------------------------------------------------------------ // the client performing the trasaction shoud enter name. client=JOptionPane.showInputDialog("Enter Client name:"); user=JOptionPane.showInputDialog("Enter Amount Of Purchase."); Amount_of_Purchase=Double.parseDouble(user); // the random number is being genarated here.. radomNumber=(int)(Math.random()*8)+8;
  • 3. Solution: //state sales tax is calculated. state_sales_tax=Amount_of_Purchase*0.04; client.length(); //state county sales tax is calculated. county_sales_tax=Amount_of_Purchase*0.02; // total sales tax. total_sales_tax = state_sales_tax + county_sales_tax; // total sales. total_sales = Amount_of_Purchase - total_sales_tax; // this java option pane displays the results of the program. JOptionPane.showMessageDialog(null, "n The Transaction Code is:" +client.length()+"/" +radomNumber+"/"+"2016 -"+radomNumber); JOptionPane.showMessageDialog(null,"n CLIENT NAME: "+ client+ "n------------------------ ------------------" +"n The Amount of Purchase is: Zmk " + Amount_of_Purchase+ "n------------------------------------------"+"n The Total Sales: Zmk " + total_sales+"n------------------------------------------" +"n The State_Sales_Tax: Zmk "+ state_sales_tax+ "n County_Sales_Tax: Zmk " +county_sales_tax); System.exit.(0); } //end of program. }