Are you looking for the Answers to NPTEL Programming In Java Assignment 8? This article will help you with the answer to the National Programme on Technology Enhanced Learning (NPTEL) Course ” NPTEL Programming In Java Assignment 8 “
What is Programming In Java?
With the growth of Information and Communication Technology, there is a need to develop large and complex software. Further, those software should be platform independent, Internet enabled, easy to modify, secure, and robust. To meet this requirement object-oriented paradigm has been developed and based on this paradigm the Java programming language emerges as the best programming environment. Now, Java programming language is being used for mobile programming, Internet programming, and many other applications compatible to distributed systems. This course aims to cover the essential topics of Java programming so that the participants can improve their skills to cope with the current demand of IT industries and solve many problems in their own filed of studies.
CRITERIA TO GET A CERTIFICATE
Average assignment score = 25% of the average of best 8 assignments out of the total 12 assignments given in the course.
Exam score = 75% of the proctored certification exam score out of 100
Final score = Average assignment score + Exam score
YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF THE AVERAGE ASSIGNMENT SCORE >=10/25 AND EXAM SCORE >= 30/75. If one of the 2 criteria is not met, you will not get the certificate even if the Final score >= 40/100.
Below you can find the answers for NPTEL Programming In Java Assignment 8
Assignment No. | Answers |
---|---|
Programming In Java Assignment 1 | Click Here |
Programming In Java Assignment 2 | Click Here |
Programming In Java Assignment 3 | Click Here |
Programming In Java Assignment 4 | Click Here |
Programming In Java Assignment 5 | Click Here |
Programming In Java Assignment 6 | Click Here |
Programming In Java Assignment 7 | Click Here |
Programming In Java Assignment 8 | Click Here |
NPTEL Programming In Java Assignment 8 Answers:-
Q1. Write a program which will print a pyramid of “*” ‘s of height “n” and print the number of “*” ‘s in the pyramid.
Code:-
For Week 8 MCQ/Quiz Answers Click Me
import java.util.*;
public class Pattern1 {
public static void main(String[] args) {
Scanner inr = new Scanner(System.in);
int n = inr.nextInt();
// Add the necessary code in the below space
int k = 0,sum=0;
for(int i = 1; i <= n; ++i, k = 0) {
for(int space = 1; space <= n - i; ++space) {
System.out.print(" ");
}
while(k != 2 * i - 1) {
System.out.print("* ");
sum=sum+1;
++k;
}
System.out.println();
}
System.out.println(sum);
}
}
Q2. Write a program which will print a pascal pyramid of “*” ‘s of height “l” .
Code:-
For Online programming test help and final exam preparation material Click Me
import java.util.*;
public class Pattern2 {
public static void main(String[] args) {
Scanner inr = new Scanner(System.in);
int l = inr.nextInt();
// Add the necessary code in the below space
int i,j;
int space=l-1;
/*run loop (parent loop) till number of rows*/
for(i=0;i< l;i++)
{
/*loop for initially space, before star printing*/
for(j=0;j< space;j++)
{
System.out.print(" ");
}
for(j=0;j<=i;j++)
{
System.out.print("* ");
}
System.out.print("\n");
space--; /* decrement one space after one row*/
}
}
}
Next Week Answers: Assignment 07
Q3. Write a program which will print a pyramid of “numbers” ‘s of height “n” and print the sum of all number’s in the pyramid.
Code:-
import java.util.*;
public class Pattern3 {
public static void main(String[] args) {
Scanner inr = new Scanner(System.in);
int n = inr.nextInt();
// Add the necessary code in the below space
int k = 1,sum=0;
for(int i = 1; i <= n; ++i, k = 1) {
for(int space = 1; space <= n-i; ++space) {
System.out.print(" ");
}
while(k <= 2 * i - 1) {
System.out.print(k+" ");
sum=sum+k;
++k;
}
System.out.println();
}
System.out.println(sum);
}
}
Q4. Write a program to print symmetric Pascal’s triangle of “*” ‘s of height “l” of odd length . If input “l” is even then your program will print “Invalid line number”.
Code:-
import java.util.*;
public class Pattern4 {
public static void main(String[] args) {
Scanner inr = new Scanner(System.in);
int l = inr.nextInt();
// Add the necessary code in the below space
int ul=0; // Upper Line
int ll=0; // Lower Line
// Check whether line number is odd
if (l%2!=0){
ul=(l/2)+1;
ll=l-ul;
//Code for upper half
for(int i=1;i<=ul; i++){
//Space management
for(int s=1;s<=(ul-i); s++){
System.out.print(" ");
}
// Star management
for(int j=1;j<=i; j++){
System.out.print("* ");
}
System.out.println();
}
//Code for lower half
int llc=ll;
for(int i=1;i<=ll; i++){
//Space management
for(int s=llc;s<ll; s++){
System.out.print(" ");
}
// Star management
for(int j=1;j-1<=ll-i; j++){
System.out.print(" *");
}
llc--;
System.out.println();
}
}
else{
System.out.print("Invalid line number");
}
}
}
Q5.Write a program to display any digit(n) from 0-9 represented as a “7 segment display”.
Code:-
For Online programming test help and final exam preparation material Click Me
This code will be uploaded soon and will be notified on our telegram channel so JOIN
For other courses answers:- Visit
For Internship and job updates:- Visit
Disclaimer: We do not claim 100% surety of answers, these answers are based on our sole knowledge, and by posting these answers we are just trying to help students, so we urge do your assignment on your own.
if you have any suggestions then comment below or contact us at [email protected]
If you found this article Interesting and helpful, don’t forget to share it with your friends to get this information.
NPTEL Programming In Java Assignment 8 Answers 2022:- All the Answers provided here to help the students as a reference, You must submit your assignment at your own knowledge.